diff --git a/editor/browser.js b/editor/browser.js index 960ef953..ffcfc32d 100644 --- a/editor/browser.js +++ b/editor/browser.js @@ -35,6 +35,8 @@ var isOpera_ = !!window.opera; var isWebkit_ = userAgent.indexOf("AppleWebKit") >= 0; var isGecko_ = userAgent.indexOf('Gecko/') >= 0; var isIE_ = userAgent.indexOf('MSIE') >= 0; +var isChrome_ = userAgent.indexOf('Chrome/') >= 0; +var isWindows_ = userAgent.indexOf('Windows') >= 0; var supportsSelectors_ = (function() { return !!svg.querySelector; @@ -153,6 +155,8 @@ svgedit.browser.isOpera = function() { return isOpera_; } svgedit.browser.isWebkit = function() { return isWebkit_; } svgedit.browser.isGecko = function() { return isGecko_; } svgedit.browser.isIE = function() { return isIE_; } +svgedit.browser.isChrome = function() { return isChrome_; } +svgedit.browser.isWindows = function() { return isWindows_; } svgedit.browser.supportsSelectors = function() { return supportsSelectors_; } svgedit.browser.supportsXpath = function() { return supportsXpath_; } diff --git a/editor/svgcanvas.js b/editor/svgcanvas.js index d5341d12..12fdb11d 100644 --- a/editor/svgcanvas.js +++ b/editor/svgcanvas.js @@ -2516,9 +2516,16 @@ var getMouseTarget = this.getMouseTarget = function(evt) { tlist.appendItem(svgroot.createSVGTransform()); if(svgedit.browser.supportsNonScalingStroke()) { + //Handle crash for newer Chrome + Windows: https://code.google.com/p/svg-edit/issues/detail?id=904 + if(svgedit.browser.isChrome() && svgedit.browser.isWindows()) { + var _stroke = mouse_target.getAttributeNS(null, 'stroke'); + mouse_target.removeAttributeNS(null, 'stroke'); + //Re-apply stroke after delay. Anything higher than 1 seems to cause flicker + setTimeout(function() { mouse_target.setAttributeNS(null, 'stroke', _stroke) }, 1); + } mouse_target.style.vectorEffect = 'non-scaling-stroke'; var all = mouse_target.getElementsByTagName('*'), len = all.length; - for(var i = 0; i < all.length; i++) { + for(var i = 0; i < len; i++) { all[i].style.vectorEffect = 'non-scaling-stroke'; } }