Second attempt to fix bug 904 by asyazwan

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2054 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Jeff Schiller 2012-02-23 04:13:59 +00:00
parent 53b1c45ed9
commit 1d05b8340b
1 changed files with 14 additions and 6 deletions

View File

@ -2517,16 +2517,24 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
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);
// TODO: Remove this workaround (all isChromeWindows blocks) once vendor fixes the issue
var isChromeWindows = svgedit.browser.isChrome() && svgedit.browser.isWindows();
if(isChromeWindows) {
var delayedStroke = function(ele) {
var _stroke = ele.getAttributeNS(null, 'stroke');
ele.removeAttributeNS(null, 'stroke');
//Re-apply stroke after delay. Anything higher than 1 seems to cause flicker
setTimeout(function() { ele.setAttributeNS(null, 'stroke', _stroke) }, 1);
}
}
mouse_target.style.vectorEffect = 'non-scaling-stroke';
var all = mouse_target.getElementsByTagName('*'), len = all.length;
if(isChromeWindows) delayedStroke(mouse_target);
var all = mouse_target.getElementsByTagName('*'),
len = all.length;
for(var i = 0; i < len; i++) {
all[i].style.vectorEffect = 'non-scaling-stroke';
if(isChromeWindows) delayedStroke(all[i]);
}
}
}