Sfoglia il codice sorgente

don't always set preserveAspectRatio to true

Gildas 7 anni fa
parent
commit
6e0c1e221a
1 ha cambiato i file con 3 aggiunte e 1 eliminazioni
  1. 3 1
      lib/single-file/doc-helper.js

+ 3 - 1
lib/single-file/doc-helper.js

@@ -171,8 +171,10 @@ this.docHelper = this.docHelper || (() => {
 						doc.body.appendChild(imgElement);
 						naturalWidth = imgElement.width;
 						naturalHeight = imgElement.height;
-						preserveAspectRatio = true;
 						imgElement.remove();
+						if (naturalWidth > 1 && naturalHeight > 1) {
+							preserveAspectRatio = true;
+						}
 					}
 					imageData = {
 						width: imageElement.width,