|
@@ -114,7 +114,9 @@ this.imagesMinifier = this.imagesMinifier || (() => {
|
|
|
svgElement.setAttributeNS(SVG_NS, "viewBox", "0 0 " + width + " " + height);
|
|
svgElement.setAttributeNS(SVG_NS, "viewBox", "0 0 " + width + " " + height);
|
|
|
svgElement.setAttributeNS(SVG_NS, "width", imageData.clientWidth);
|
|
svgElement.setAttributeNS(SVG_NS, "width", imageData.clientWidth);
|
|
|
svgElement.setAttributeNS(SVG_NS, "height", imageData.clientHeight);
|
|
svgElement.setAttributeNS(SVG_NS, "height", imageData.clientHeight);
|
|
|
- svgElement.setAttributeNS(SVG_NS, "preserveAspectRatio", "none");
|
|
|
|
|
|
|
+ if (!imageData.preserveAspectRatio) {
|
|
|
|
|
+ svgElement.setAttributeNS(SVG_NS, "preserveAspectRatio", "none");
|
|
|
|
|
+ }
|
|
|
useElement.setAttributeNS(SVG_NS, "xlink:href", "#single-file-" + urlIndex);
|
|
useElement.setAttributeNS(SVG_NS, "xlink:href", "#single-file-" + urlIndex);
|
|
|
const imageElement = doc.getElementById("single-file-" + urlIndex);
|
|
const imageElement = doc.getElementById("single-file-" + urlIndex);
|
|
|
if (!imageElement.getAttributeNS(SVG_NS, "width") && !imageElement.getAttributeNS(SVG_NS, "height")) {
|
|
if (!imageElement.getAttributeNS(SVG_NS, "width") && !imageElement.getAttributeNS(SVG_NS, "height")) {
|
|
@@ -122,7 +124,7 @@ this.imagesMinifier = this.imagesMinifier || (() => {
|
|
|
imageElement.setAttributeNS(SVG_NS, "width", width);
|
|
imageElement.setAttributeNS(SVG_NS, "width", width);
|
|
|
imageElement.setAttributeNS(SVG_NS, "height", height);
|
|
imageElement.setAttributeNS(SVG_NS, "height", height);
|
|
|
}
|
|
}
|
|
|
- // svgElement.style.border = "1px solid red";
|
|
|
|
|
|
|
+ svgElement.style.border = "1px solid red";
|
|
|
imgElement.parentElement.replaceChild(svgElement, imgElement);
|
|
imgElement.parentElement.replaceChild(svgElement, imgElement);
|
|
|
}
|
|
}
|
|
|
|
|
|