Fix Issue 21: Opera/WebKit sometimes messed up the bounding box calculation. Also prevented WebKit from deleting the canvas.
git-svn-id: http://svg-edit.googlecode.com/svn/trunk@147 eee81c28-f429-11dd-99c0-75d572ba1dddmaster
parent
7a69efd050
commit
df524d2fbc
|
@ -192,10 +192,10 @@ function SvgCanvas(c)
|
|||
var recalculateSelectedOutline = function() {
|
||||
if (selected != null && selectedOutline != null) {
|
||||
var bbox = selected.getBBox();
|
||||
var sw = selected.getAttribute("stroke-width");
|
||||
var sw = parseInt(selected.getAttribute("stroke-width"));
|
||||
var offset = 1;
|
||||
if (sw != null && sw != "") {
|
||||
offset += parseInt(sw)/2;
|
||||
if (!isNaN(sw)) {
|
||||
offset += sw/2;
|
||||
}
|
||||
if (selected.tagName == "text") {
|
||||
offset += 2;
|
||||
|
@ -217,9 +217,11 @@ function SvgCanvas(c)
|
|||
start_x = x;
|
||||
start_y = y;
|
||||
var t = evt.target;
|
||||
if (t != svgroot) {
|
||||
selectElement(t);
|
||||
// WebKit returns <div> when the canvas is clicked, Firefox/Opera return <svg>
|
||||
if (t.nodeName.toLowerCase() == "div" || t.nodeName.toLowerCase() == "svg") {
|
||||
t = null;
|
||||
}
|
||||
selectElement(t);
|
||||
break;
|
||||
case "fhellipse":
|
||||
case "fhrect":
|
||||
|
@ -790,9 +792,6 @@ function SvgCanvas(c)
|
|||
t.parentNode.removeChild(t);
|
||||
call("deleted",t);
|
||||
}
|
||||
else {
|
||||
alert("Error! Nothing selected!");
|
||||
}
|
||||
}
|
||||
|
||||
this.moveToTopSelectedElement = function() {
|
||||
|
@ -800,9 +799,6 @@ function SvgCanvas(c)
|
|||
var t = selected;
|
||||
t.parentNode.appendChild(t);
|
||||
}
|
||||
else {
|
||||
alert("Error! Nothing selected!");
|
||||
}
|
||||
}
|
||||
|
||||
this.moveToBottomSelectedElement = function() {
|
||||
|
@ -810,9 +806,6 @@ function SvgCanvas(c)
|
|||
var t = selected;
|
||||
t.parentNode.insertBefore(t, t.parentNode.firstChild);
|
||||
}
|
||||
else {
|
||||
alert("Error! Nothing selected!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue