Merge pull request #44 from SVG-Edit/hide-overview-in-chrome

Hide overview extension in chrome
master
Philip Rogers 2015-12-03 17:32:14 -08:00
commit 02a9f6f0b4
1 changed files with 14 additions and 8 deletions

View File

@ -11,7 +11,13 @@
var overviewWindowGlobals = {}; var overviewWindowGlobals = {};
svgEditor.addExtension("overview_window", function() { 'use strict'; 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= "\ 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_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;\">\ <div id=\"overview_window_content\" style=\"position:relative; left:12px; top:0px;\">\
@ -26,7 +32,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
</div>"; </div>";
$("#sidepanels").append(propsWindowHtml); $("#sidepanels").append(propsWindowHtml);
//define dynamic animation of the view box. // Define dynamic animation of the view box.
var updateViewBox = function(){ var updateViewBox = function(){
var portHeight=parseFloat($("#workarea").css("height")); var portHeight=parseFloat($("#workarea").css("height"));
var portWidth=parseFloat($("#workarea").css("width")); var portWidth=parseFloat($("#workarea").css("width"));
@ -55,7 +61,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
$("#workarea").resize(updateViewBox); $("#workarea").resize(updateViewBox);
updateViewBox(); updateViewBox();
//comphensate for changes in zoom and canvas size // Compensate for changes in zoom and canvas size.
var updateViewDimensions= function(){ var updateViewDimensions= function(){
var viewWidth=$("#svgroot").attr("width"); var viewWidth=$("#svgroot").attr("width");
var viewHeight=$("#svgroot").attr("height"); var viewHeight=$("#svgroot").attr("height");
@ -82,7 +88,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
}; };
updateViewDimensions(); 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; overviewWindowGlobals.viewBoxDragging=false;
var updateViewPortFromViewBox = function(){ var updateViewPortFromViewBox = function(){
@ -105,7 +111,7 @@ svgEditor.addExtension("overview_window", function() { 'use strict';
,stop :function(){overviewWindowGlobals.viewBoxDragging=false;} ,stop :function(){overviewWindowGlobals.viewBoxDragging=false;}
}); });
$("#overviewMiniView").click(function(evt){ $("#overviewMiniView").click(function(evt){
//Firefox doesn't support evt.offsetX and evt.offsetY // Firefox doesn't support evt.offsetX and evt.offsetY.
var mouseX=(evt.offsetX || evt.originalEvent.layerX); var mouseX=(evt.offsetX || evt.originalEvent.layerX);
var mouseY=(evt.offsetY || evt.originalEvent.layerY); var mouseY=(evt.offsetY || evt.originalEvent.layerY);
var overviewWidth =$("#overviewMiniView").attr("width" ); var overviewWidth =$("#overviewMiniView").attr("width" );