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;
|
||||
|
||||
const widthProperty = image!.style.width;
|
||||
if (widthProperty) {
|
||||
actualWidth = widthProperty.endsWith("px")
|
||||
? widthProperty.substring(0, widthProperty.length - 2)
|
||||
: widthProperty;
|
||||
} else {
|
||||
actualWidth = String(width);
|
||||
}
|
||||
|
||||
const heightProperty = image!.style.height;
|
||||
if (heightProperty) {
|
||||
actualHeight = heightProperty.endsWith("px")
|
||||
? heightProperty.substring(0, heightProperty.length - 2)
|
||||
: heightProperty;
|
||||
} else {
|
||||
actualHeight = String(height);
|
||||
}
|
||||
}
|
||||
|
||||
function setPointerCapture(event: PointerEvent): void {
|
||||
|
|
Loading…
Reference in a new issue