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() {
|
var recalculateSelectedOutline = function() {
|
||||||
if (selected != null && selectedOutline != null) {
|
if (selected != null && selectedOutline != null) {
|
||||||
var bbox = selected.getBBox();
|
var bbox = selected.getBBox();
|
||||||
var sw = selected.getAttribute("stroke-width");
|
var sw = parseInt(selected.getAttribute("stroke-width"));
|
||||||
var offset = 1;
|
var offset = 1;
|
||||||
if (sw != null && sw != "") {
|
if (!isNaN(sw)) {
|
||||||
offset += parseInt(sw)/2;
|
offset += sw/2;
|
||||||
}
|
}
|
||||||
if (selected.tagName == "text") {
|
if (selected.tagName == "text") {
|
||||||
offset += 2;
|
offset += 2;
|
||||||
|
@ -217,9 +217,11 @@ function SvgCanvas(c)
|
||||||
start_x = x;
|
start_x = x;
|
||||||
start_y = y;
|
start_y = y;
|
||||||
var t = evt.target;
|
var t = evt.target;
|
||||||
if (t != svgroot) {
|
// WebKit returns <div> when the canvas is clicked, Firefox/Opera return <svg>
|
||||||
selectElement(t);
|
if (t.nodeName.toLowerCase() == "div" || t.nodeName.toLowerCase() == "svg") {
|
||||||
|
t = null;
|
||||||
}
|
}
|
||||||
|
selectElement(t);
|
||||||
break;
|
break;
|
||||||
case "fhellipse":
|
case "fhellipse":
|
||||||
case "fhrect":
|
case "fhrect":
|
||||||
|
@ -790,9 +792,6 @@ function SvgCanvas(c)
|
||||||
t.parentNode.removeChild(t);
|
t.parentNode.removeChild(t);
|
||||||
call("deleted",t);
|
call("deleted",t);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
alert("Error! Nothing selected!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.moveToTopSelectedElement = function() {
|
this.moveToTopSelectedElement = function() {
|
||||||
|
@ -800,9 +799,6 @@ function SvgCanvas(c)
|
||||||
var t = selected;
|
var t = selected;
|
||||||
t.parentNode.appendChild(t);
|
t.parentNode.appendChild(t);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
alert("Error! Nothing selected!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.moveToBottomSelectedElement = function() {
|
this.moveToBottomSelectedElement = function() {
|
||||||
|
@ -810,9 +806,6 @@ function SvgCanvas(c)
|
||||||
var t = selected;
|
var t = selected;
|
||||||
t.parentNode.insertBefore(t, t.parentNode.firstChild);
|
t.parentNode.insertBefore(t, t.parentNode.firstChild);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
alert("Error! Nothing selected!");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue