Deal with case where no style.{width,height} is set for size dimensions

This commit is contained in:
Henrik Giesel 2021-07-21 18:32:07 +02:00 committed by Damien Elmes
parent be3aaa1519
commit 1472dc854c

View file

@ -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 {