mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 08:22:24 -04:00
Deal with case where no style.{width,height} is set for size dimensions
This commit is contained in:
parent
be3aaa1519
commit
1472dc854c
1 changed files with 14 additions and 6 deletions
|
@ -71,14 +71,22 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
height = image!.clientHeight;
|
height = image!.clientHeight;
|
||||||
|
|
||||||
const widthProperty = image!.style.width;
|
const widthProperty = image!.style.width;
|
||||||
actualWidth = widthProperty.endsWith("px")
|
if (widthProperty) {
|
||||||
? widthProperty.substring(0, widthProperty.length - 2)
|
actualWidth = widthProperty.endsWith("px")
|
||||||
: widthProperty;
|
? widthProperty.substring(0, widthProperty.length - 2)
|
||||||
|
: widthProperty;
|
||||||
|
} else {
|
||||||
|
actualWidth = String(width);
|
||||||
|
}
|
||||||
|
|
||||||
const heightProperty = image!.style.height;
|
const heightProperty = image!.style.height;
|
||||||
actualHeight = heightProperty.endsWith("px")
|
if (heightProperty) {
|
||||||
? heightProperty.substring(0, heightProperty.length - 2)
|
actualHeight = heightProperty.endsWith("px")
|
||||||
: heightProperty;
|
? heightProperty.substring(0, heightProperty.length - 2)
|
||||||
|
: heightProperty;
|
||||||
|
} else {
|
||||||
|
actualHeight = String(height);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setPointerCapture(event: PointerEvent): void {
|
function setPointerCapture(event: PointerEvent): void {
|
||||||
|
|
Loading…
Reference in a new issue