Fixes to foreignObject Extension

(From Alex)
This commit is contained in:
Jacques Distler 2010-02-17 14:48:49 -06:00
parent ea581a50ae
commit b302bf36c5

View file

@ -21,7 +21,9 @@ $(function() {
htmlns = "http://www.w3.org/1999/xhtml",
mathns = "http://www.w3.org/1998/Math/MathML",
editingforeign = false,
svgdoc = S.svgroot.parentNode.ownerDocument;
svgdoc = S.svgroot.parentNode.ownerDocument,
started,
newFO;
var properlySourceSizeTextArea = function(){
@ -200,7 +202,8 @@ $(function() {
if(svgCanvas.getMode() == "foreign") {
var newText = S.addSvgElementFromJson({
started = true;
newFO = S.addSvgElementFromJson({
"element": "foreignObject",
"attr": {
"x": opts.start_x,
@ -225,23 +228,22 @@ $(function() {
m.appendChild(mi);
m.appendChild(mo);
m.appendChild(mi2);
newText.appendChild(m);
newFO.appendChild(m);
return {
started: true
}
}
},
mouseUp: function(opts) {
var e = opts.event;
if(svgCanvas.getMode() == "foreign") {
var attrs = $(e.target).attr(["width", "height"]);
keep = (attrs.width != 0 || attrs.height != 0);
svgCanvas.addToSelection([e.target], true);
var e = opts.event;
if(svgCanvas.getMode() == "foreign" && started) {
var attrs = $(newFO).attr(["width", "height"]);
keep = (attrs.width != 0 || attrs.height != 0);
svgCanvas.addToSelection([newFO], true);
return {
keep: keep,
element: e.target
element: newFO
}
}