Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide overview extension in chrome #44

Merged
merged 2 commits into from
Dec 4, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions editor/extensions/ext-overview_window.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@

var overviewWindowGlobals = {};
svgEditor.addExtension("overview_window", function() { 'use strict';
//define and insert the base html element
// Temporarily disabled in Chrome, see https://github.com/SVG-Edit/svgedit/issues/26 and
// https://code.google.com/p/chromium/issues/detail?id=565120.
if (svgedit.browser.isChrome()) {
return;
}

// Define and insert the base html element.
var propsWindowHtml= "\
<div id=\"overview_window_content_pane\" style=\" width:100%; word-wrap:break-word; display:inline-block; margin-top:20px;\">\
<div id=\"overview_window_content\" style=\"position:relative; left:12px; top:0px;\">\
Expand All @@ -26,7 +32,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
</div>";
$("#sidepanels").append(propsWindowHtml);

//define dynamic animation of the view box.
// Define dynamic animation of the view box.
var updateViewBox = function(){
var portHeight=parseFloat($("#workarea").css("height"));
var portWidth=parseFloat($("#workarea").css("width"));
Expand Down Expand Up @@ -55,7 +61,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
$("#workarea").resize(updateViewBox);
updateViewBox();

//comphensate for changes in zoom and canvas size
// Compensate for changes in zoom and canvas size.
var updateViewDimensions= function(){
var viewWidth=$("#svgroot").attr("width");
var viewHeight=$("#svgroot").attr("height");
Expand All @@ -64,9 +70,9 @@ svgEditor.addExtension("overview_window", function() { 'use strict';

if(svgedit.browser.isIE())
{
//This has only been tested with Firefox 10 and IE 9 (without chrome frame).
//I am not sure if if is Firefox or IE that is being non compliant here.
//Either way the one that is noncompliant may become more compliant later.
// This has only been tested with Firefox 10 and IE 9 (without chrome frame).
// I am not sure if if is Firefox or IE that is being non compliant here.
// Either way the one that is noncompliant may become more compliant later.
//TAG:HACK
//TAG:VERSION_DEPENDENT
//TAG:BROWSER_SNIFFING
Expand All @@ -82,7 +88,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
};
updateViewDimensions();

//set up the overview window as a controller for the view port.
// Set up the overview window as a controller for the view port.
overviewWindowGlobals.viewBoxDragging=false;
var updateViewPortFromViewBox = function(){

Expand All @@ -105,7 +111,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
,stop :function(){overviewWindowGlobals.viewBoxDragging=false;}
});
$("#overviewMiniView").click(function(evt){
//Firefox doesn't support evt.offsetX and evt.offsetY
// Firefox doesn't support evt.offsetX and evt.offsetY.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request is fine, but this comment is now stale. Firefox supports event.offsetX as of July this year.

var mouseX=(evt.offsetX || evt.originalEvent.layerX);
var mouseY=(evt.offsetY || evt.originalEvent.layerY);
var overviewWidth =$("#overviewMiniView").attr("width" );
Expand Down