Adding vectorEffect: non-scaling-stroke workaround to all of Webkit, since this bug has propagated to Safari 6 and Mobile Safari on iOS6
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2154 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
4cc9c7d0ec
commit
7846230af9
|
@ -2516,26 +2516,28 @@ var getMouseTarget = this.getMouseTarget = function(evt) {
|
|||
tlist.appendItem(svgroot.createSVGTransform());
|
||||
|
||||
if(svgedit.browser.supportsNonScalingStroke()) {
|
||||
//Handle crash for newer Chrome: https://code.google.com/p/svg-edit/issues/detail?id=904
|
||||
//Chromium issue: https://code.google.com/p/chromium/issues/detail?id=114625
|
||||
// TODO: Remove this workaround (all isChrome blocks) once vendor fixes the issue
|
||||
var isChrome = svgedit.browser.isChrome();
|
||||
if(isChrome) {
|
||||
// Handle crash for newer Chrome and Safari 6 (Mobile and Desktop):
|
||||
// https://code.google.com/p/svg-edit/issues/detail?id=904
|
||||
// Chromium issue: https://code.google.com/p/chromium/issues/detail?id=114625
|
||||
// TODO: Remove this workaround once vendor fixes the issue
|
||||
var isWebkit = svgedit.browser.isWebkit();
|
||||
|
||||
if(isWebkit) {
|
||||
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);
|
||||
setTimeout(function() { ele.setAttributeNS(null, 'stroke', _stroke) }, 0);
|
||||
}
|
||||
}
|
||||
mouse_target.style.vectorEffect = 'non-scaling-stroke';
|
||||
if(isChrome) delayedStroke(mouse_target);
|
||||
if(isWebkit) 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(isChrome) delayedStroke(all[i]);
|
||||
if(isWebkit) delayedStroke(all[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue