diff --git a/public/svg-edit/editor/images/logo.png b/public/svg-edit/editor/images/logo.png index c9c61ae9..7c04931c 100644 Binary files a/public/svg-edit/editor/images/logo.png and b/public/svg-edit/editor/images/logo.png differ diff --git a/public/svg-edit/editor/images/svg_edit_icons.svg b/public/svg-edit/editor/images/svg_edit_icons.svg index d297a8c3..4f8f75e2 100644 --- a/public/svg-edit/editor/images/svg_edit_icons.svg +++ b/public/svg-edit/editor/images/svg_edit_icons.svg @@ -1,106 +1,39 @@  - + diff --git a/public/svg-edit/editor/svg-editor.css b/public/svg-edit/editor/svg-editor.css index 00e5c941..7b9116ba 100644 --- a/public/svg-edit/editor/svg-editor.css +++ b/public/svg-edit/editor/svg-editor.css @@ -29,13 +29,13 @@ body { } #svg_editor #svgcanvas { + line-height: normal; display: inline-block; background-color: #A0A0A0; text-align: center; vertical-align: middle; width: 640px; height: 480px; - line-height:normal; -apple-dashboard-region:dashboard-region(control rectangle 0px 0px 0px 0px); /* for widget regions that shouldn't react to dragging */ position: relative; /* @@ -958,4 +958,4 @@ button#tool_docprops_cancel { -webkit-border-radius: 0px; } -foreignObject { line-height:1.0; } \ No newline at end of file +foreignObject { line-height:1.0; } diff --git a/public/svg-edit/editor/svgcanvas.js b/public/svg-edit/editor/svgcanvas.js index 6d50f233..9c9d66b1 100644 --- a/public/svg-edit/editor/svgcanvas.js +++ b/public/svg-edit/editor/svgcanvas.js @@ -87,6 +87,8 @@ function SvgCanvas(container) var isOpera = !!window.opera, isWebkit = navigator.userAgent.indexOf("AppleWebKit") != -1, support = {}, + htmlns = "http://www.w3.org/1999/xhtml", + mathns = "http://www.w3.org/1998/Math/MathML", // this defines which elements and attributes that we support svgWhiteList = { @@ -1064,7 +1066,7 @@ function BatchCommand(text) { } for(var attr in defaults) { var val = defaults[attr]; - if(element.localName != 'math' && element.getAttribute(attr) == val) { + if(element.getAttribute(attr) == val) { element.removeAttribute(attr); } } @@ -2718,6 +2720,13 @@ function BatchCommand(text) { if (mouse_target.correspondingUseElement) mouse_target = mouse_target.correspondingUseElement; + // for foreign content, go up until we find the foreignObject + if ($.inArray(mouse_target.namespaceURI, [mathns, htmlns]) != -1) { + while (mouse_target.nodeName != "foreignObject") { + mouse_target = mouse_target.parentNode; + } + } + // go up until we hit a child of a layer while (mouse_target.parentNode.parentNode.tagName == "g") { mouse_target = mouse_target.parentNode; @@ -6495,6 +6504,10 @@ function BatchCommand(text) { ret = selected.getBBox(); ret.x += parseFloat(selected.getAttribute('x')); ret.y += parseFloat(selected.getAttribute('y')); + } else if(elem.nodeName == 'foreignObject') { + ret = selected.getBBox(); + ret.x += parseFloat(selected.getAttribute('x')); + ret.y += parseFloat(selected.getAttribute('y')); } else { try { ret = selected.getBBox(); } catch(e) { ret = null; } @@ -7618,7 +7631,7 @@ function BatchCommand(text) { // Function: getVersion // Returns a string which describes the revision number of SvgCanvas. this.getVersion = function() { - return "svgcanvas.js ($Rev: 1367 $)"; + return "svgcanvas.js ($Rev: 1369 $)"; }; this.setUiStrings = function(strs) { diff --git a/public/svg-edit/test/test1.html b/public/svg-edit/test/test1.html index 873f5f5c..f7520049 100644 --- a/public/svg-edit/test/test1.html +++ b/public/svg-edit/test/test1.html @@ -45,10 +45,11 @@ // TODO: Test these paths: // "m400.00491,625.01379a1.78688,1.78688 0 1 1-3.57373,0a1.78688,1.78688 0 1 13.57373,0z" // "m36.812,15.8566c-28.03099,0 -26.28099,12.15601 -26.28099,12.15601l0.03099,12.59399h26.75v3.781h-37.37399c0,0 -17.938,-2.034 -133.00001,26.25c115.06201,28.284 130.71801,27.281 130.71801,27.281h9.34399v-13.125c0,0 -0.504,-15.656 15.40601,-15.656h26.532c0,0 14.90599,0.241 14.90599,-14.406v-24.219c0,0 2.263,-14.65601 -27.032,-14.65601zm-14.75,8.4684c2.662,0 4.813,2.151 4.813,4.813c0,2.661 -2.151,4.812 -4.813,4.812c-2.661,0 -4.812,-2.151 -4.812,-4.812c0,-2.662 2.151,-4.813 4.812,-4.813z" + // "m 0,0 l 200,0 l 0,100 L 0,100" svgCanvas.setSvgString("" + "" + - "" + + "" + ""); var p1 = document.getElementById("p1"), @@ -72,6 +73,12 @@ // convert and verify segments var d = convert(p1, true); equals(d, "m100,100l100,0z", "Converted path to relative string"); + + // TODO: see why this isn't working in SVG-edit + d = convert(p2, true); + QUnit.log(d); + d = convert(p2, false); + QUnit.log(d); }); module("Transform Module");