Dispaly "actualHeight / actualWidth" even in constrained mode

This commit is contained in:
Henrik Giesel 2021-07-21 18:22:09 +02:00 committed by Damien Elmes
parent 4da68e3583
commit be3aaa1519

View file

@ -25,6 +25,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let naturalWidth = 0;
let naturalHeight = 0;
let actualWidth = "";
let actualHeight = "";
let containerTop = 0;
let containerLeft = 0;
@ -66,6 +69,16 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
left = imageRect.left - containerLeft;
width = image!.clientWidth;
height = image!.clientHeight;
const widthProperty = image!.style.width;
actualWidth = widthProperty.endsWith("px")
? widthProperty.substring(0, widthProperty.length - 2)
: widthProperty;
const heightProperty = image!.style.height;
actualHeight = heightProperty.endsWith("px")
? heightProperty.substring(0, heightProperty.length - 2)
: heightProperty;
}
function setPointerCapture(event: PointerEvent): void {
@ -141,7 +154,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</div>
{#if showDimensions}
<div class="image-handle-dimensions" class:is-rtl={isRtl}>
{width}&times;{height} (Original: {naturalWidth}&times;{naturalHeight})
{actualWidth}&times;{actualHeight} (Original: {naturalWidth}&times;{naturalHeight})
</div>
{/if}
<div