mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 07:37:11 -05:00
Show custom dimensions again
This commit is contained in:
parent
13f5819f48
commit
2f94208381
1 changed files with 8 additions and 17 deletions
|
|
@ -74,31 +74,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
height = activeImage!.clientHeight;
|
height = activeImage!.clientHeight;
|
||||||
|
|
||||||
/* we do not want the actual width, but rather the intended display width */
|
/* we do not want the actual width, but rather the intended display width */
|
||||||
const widthProperty = activeImage!.style.width;
|
const widthAttribute = activeImage!.getAttribute("width");
|
||||||
let inPixel = false;
|
|
||||||
customDimensions = false;
|
customDimensions = false;
|
||||||
|
|
||||||
if (widthProperty) {
|
if (widthAttribute) {
|
||||||
if (widthProperty.endsWith("px")) {
|
actualWidth = widthAttribute;
|
||||||
actualWidth = widthProperty.substring(0, widthProperty.length - 2);
|
|
||||||
inPixel = true;
|
|
||||||
} else {
|
|
||||||
actualWidth = widthProperty;
|
|
||||||
}
|
|
||||||
|
|
||||||
customDimensions = true;
|
customDimensions = true;
|
||||||
} else {
|
} else {
|
||||||
actualWidth = String(naturalWidth);
|
actualWidth = String(naturalWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
const heightProperty = activeImage!.style.height;
|
const heightAttribute = activeImage!.getAttribute("height");
|
||||||
if (inPixel || heightProperty === "auto") {
|
if (heightAttribute) {
|
||||||
actualHeight = String(Math.trunc(Number(actualWidth) / aspectRatio));
|
actualHeight = heightAttribute;
|
||||||
} else if (heightProperty) {
|
|
||||||
actualHeight = heightProperty.endsWith("px")
|
|
||||||
? heightProperty.substring(0, heightProperty.length - 2)
|
|
||||||
: heightProperty;
|
|
||||||
customDimensions = true;
|
customDimensions = true;
|
||||||
|
} else if (customDimensions) {
|
||||||
|
actualHeight = String(Math.trunc(Number(actualWidth) / aspectRatio));
|
||||||
} else {
|
} else {
|
||||||
actualHeight = String(naturalHeight);
|
actualHeight = String(naturalHeight);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue