Kaynağa Gözat

don't always set preserveAspectRatio to true

Gildas 7 yıl önce
ebeveyn
işleme
6e0c1e221a
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  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,