better image placing
parent
834e3e7f0e
commit
5070574728
|
@ -5534,7 +5534,6 @@ var uniquifyElems = this.uniquifyElems = function(g) {
|
||||||
|
|
||||||
// assign element its new id
|
// assign element its new id
|
||||||
elem.id = newid;
|
elem.id = newid;
|
||||||
|
|
||||||
// remap all url() attributes
|
// remap all url() attributes
|
||||||
var attrs = ids[oldid]["attrs"];
|
var attrs = ids[oldid]["attrs"];
|
||||||
var j = attrs.length;
|
var j = attrs.length;
|
||||||
|
@ -5542,9 +5541,9 @@ var uniquifyElems = this.uniquifyElems = function(g) {
|
||||||
var attr = attrs[j];
|
var attr = attrs[j];
|
||||||
attr.ownerElement.setAttribute(attr.name, "url(#" + newid + ")");
|
attr.ownerElement.setAttribute(attr.name, "url(#" + newid + ")");
|
||||||
}
|
}
|
||||||
|
|
||||||
// remap all href attributes
|
// remap all href attributes
|
||||||
var hreffers = ids[oldid]["hrefs"];
|
var hreffers = ids[oldid]["hrefs"];
|
||||||
|
console.log(hreffers)
|
||||||
var k = hreffers.length;
|
var k = hreffers.length;
|
||||||
while (k--) {
|
while (k--) {
|
||||||
var hreffer = hreffers[k];
|
var hreffer = hreffers[k];
|
||||||
|
@ -6059,15 +6058,9 @@ this.importSvgString = function(xmlString) {
|
||||||
canvash = +svgcontent.getAttribute("height");
|
canvash = +svgcontent.getAttribute("height");
|
||||||
// imported content should be 1/3 of the canvas on its largest dimension
|
// imported content should be 1/3 of the canvas on its largest dimension
|
||||||
|
|
||||||
if (innerh > innerw) {
|
|
||||||
var ts = "scale(" + (canvash/3)/vb[3] + ")";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var ts = "scale(" + (canvash/3)/vb[2] + ")";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hack to make recalculateDimensions understand how to scale
|
// Hack to make recalculateDimensions understand how to scale
|
||||||
ts = "translate(0) " + ts + " translate(0)";
|
var ts = "translate(0)";
|
||||||
|
|
||||||
var symbol = svgdoc.createElementNS(svgns, "symbol");
|
var symbol = svgdoc.createElementNS(svgns, "symbol");
|
||||||
var defs = findDefs();
|
var defs = findDefs();
|
||||||
|
|
|
@ -319,13 +319,14 @@ svgedit.utilities.getUrlFromAttr = function(attrVal) {
|
||||||
// Function: svgedit.utilities.getHref
|
// Function: svgedit.utilities.getHref
|
||||||
// Returns the given element's xlink:href value
|
// Returns the given element's xlink:href value
|
||||||
svgedit.utilities.getHref = function(elem) {
|
svgedit.utilities.getHref = function(elem) {
|
||||||
if (elem) return elem.getAttributeNS(XLINKNS, "href");
|
if (elem) return elem.getAttributeNS(XLINKNS, "href") || elem.getAttribute("href");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: svgedit.utilities.setHref
|
// Function: svgedit.utilities.setHref
|
||||||
// Sets the given element's xlink:href value
|
// Sets the given element's xlink:href value
|
||||||
svgedit.utilities.setHref = function(elem, val) {
|
svgedit.utilities.setHref = function(elem, val) {
|
||||||
elem.setAttributeNS(XLINKNS, "xlink:href", val);
|
elem.setAttributeNS(XLINKNS, "xlink:href", val);
|
||||||
|
elem.setAttribute("href", val);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Function: findDefs
|
// Function: findDefs
|
||||||
|
|
Loading…
Reference in New Issue