Fixes to foreignObject Extension
(From Alex)
This commit is contained in:
parent
ea581a50ae
commit
b302bf36c5
|
@ -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,7 +228,7 @@ $(function() {
|
|||
m.appendChild(mi);
|
||||
m.appendChild(mo);
|
||||
m.appendChild(mi2);
|
||||
newText.appendChild(m);
|
||||
newFO.appendChild(m);
|
||||
return {
|
||||
started: true
|
||||
}
|
||||
|
@ -233,15 +236,14 @@ $(function() {
|
|||
},
|
||||
mouseUp: function(opts) {
|
||||
var e = opts.event;
|
||||
|
||||
if(svgCanvas.getMode() == "foreign") {
|
||||
var attrs = $(e.target).attr(["width", "height"]);
|
||||
if(svgCanvas.getMode() == "foreign" && started) {
|
||||
var attrs = $(newFO).attr(["width", "height"]);
|
||||
keep = (attrs.width != 0 || attrs.height != 0);
|
||||
svgCanvas.addToSelection([newFO], true);
|
||||
|
||||
svgCanvas.addToSelection([e.target], true);
|
||||
return {
|
||||
keep: keep,
|
||||
element: e.target
|
||||
element: newFO
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue