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());
|
tlist.appendItem(svgroot.createSVGTransform());
|
||||||
|
|
||||||
if(svgedit.browser.supportsNonScalingStroke()) {
|
if(svgedit.browser.supportsNonScalingStroke()) {
|
||||||
//Handle crash for newer Chrome: https://code.google.com/p/svg-edit/issues/detail?id=904
|
// Handle crash for newer Chrome and Safari 6 (Mobile and Desktop):
|
||||||
//Chromium issue: https://code.google.com/p/chromium/issues/detail?id=114625
|
// https://code.google.com/p/svg-edit/issues/detail?id=904
|
||||||
// TODO: Remove this workaround (all isChrome blocks) once vendor fixes the issue
|
// Chromium issue: https://code.google.com/p/chromium/issues/detail?id=114625
|
||||||
var isChrome = svgedit.browser.isChrome();
|
// TODO: Remove this workaround once vendor fixes the issue
|
||||||
if(isChrome) {
|
var isWebkit = svgedit.browser.isWebkit();
|
||||||
|
|
||||||
|
if(isWebkit) {
|
||||||
var delayedStroke = function(ele) {
|
var delayedStroke = function(ele) {
|
||||||
var _stroke = ele.getAttributeNS(null, 'stroke');
|
var _stroke = ele.getAttributeNS(null, 'stroke');
|
||||||
ele.removeAttributeNS(null, 'stroke');
|
ele.removeAttributeNS(null, 'stroke');
|
||||||
//Re-apply stroke after delay. Anything higher than 1 seems to cause flicker
|
//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';
|
mouse_target.style.vectorEffect = 'non-scaling-stroke';
|
||||||
if(isChrome) delayedStroke(mouse_target);
|
if(isWebkit) delayedStroke(mouse_target);
|
||||||
|
|
||||||
var all = mouse_target.getElementsByTagName('*'),
|
var all = mouse_target.getElementsByTagName('*'),
|
||||||
len = all.length;
|
len = all.length;
|
||||||
for(var i = 0; i < len; i++) {
|
for(var i = 0; i < len; i++) {
|
||||||
all[i].style.vectorEffect = 'non-scaling-stroke';
|
all[i].style.vectorEffect = 'non-scaling-stroke';
|
||||||
if(isChrome) delayedStroke(all[i]);
|
if(isWebkit) delayedStroke(all[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue