correct 'use' behavior when dragging elements in webkit

git-svn-id: http://svg-edit.googlecode.com/svn/trunk@2199 eee81c28-f429-11dd-99c0-75d572ba1ddd
master
Mark MacKay 2012-11-28 05:39:48 +00:00
parent c99f759d46
commit b8c8b65024
2 changed files with 17 additions and 12 deletions

View File

@ -376,17 +376,19 @@ canvas.undoMgr = new svgedit.history.UndoManager({
if (values["stdDeviation"]) {
canvas.setBlurOffsets(cmd.elem.parentNode, values["stdDeviation"]);
}
// This is resolved in later versions of webkit, perhaps we should
// have a featured detection for correct 'use' behavior?
// ——————————
// Remove & Re-add hack for Webkit (issue 775)
if(cmd.elem.tagName === 'use' && svgedit.browser.isWebkit()) {
var elem = cmd.elem;
if(!elem.getAttribute('x') && !elem.getAttribute('y')) {
var parent = elem.parentNode;
var sib = elem.nextSibling;
parent.removeChild(elem);
parent.insertBefore(elem, sib);
}
}
//if(cmd.elem.tagName === 'use' && svgedit.browser.isWebkit()) {
// var elem = cmd.elem;
// if(!elem.getAttribute('x') && !elem.getAttribute('y')) {
// var parent = elem.parentNode;
// var sib = elem.nextSibling;
// parent.removeChild(elem);
// parent.insertBefore(elem, sib);
// }
//}
}
}
}

View File

@ -497,14 +497,17 @@ svgedit.utilities.getBBox = function(elem) {
if(elname === 'use') {
if(!ret) ret = selected.getBBox();
if(!svgedit.browser.isWebkit()) {
// This is resolved in later versions of webkit, perhaps we should
// have a featured detection for correct 'use' behavior?
// ——————————
//if(!svgedit.browser.isWebkit()) {
var bb = {};
bb.width = ret.width;
bb.height = ret.height;
bb.x = ret.x + parseFloat(selected.getAttribute('x')||0);
bb.y = ret.y + parseFloat(selected.getAttribute('y')||0);
ret = bb;
}
//}
} else if(~visElems_arr.indexOf(elname)) {
try { ret = selected.getBBox();}
catch(e) {