diff --git a/ts/editor/HandleLabel.svelte b/ts/editor/HandleLabel.svelte new file mode 100644 index 000000000..66ebdc3ff --- /dev/null +++ b/ts/editor/HandleLabel.svelte @@ -0,0 +1,62 @@ + + + +
+ +
+ + diff --git a/ts/editor/ImageHandle.svelte b/ts/editor/ImageHandle.svelte index 508ece350..1d1c07087 100644 --- a/ts/editor/ImageHandle.svelte +++ b/ts/editor/ImageHandle.svelte @@ -6,6 +6,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html import HandleBackground from "./HandleBackground.svelte"; import HandleSelection from "./HandleSelection.svelte"; import HandleControl from "./HandleControl.svelte"; + import HandleLabel from "./HandleLabel.svelte"; import ImageHandleFloat from "./ImageHandleFloat.svelte"; import ImageHandleSizeSelect from "./ImageHandleSizeSelect.svelte"; @@ -52,12 +53,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html height = 0; } + let customDimensions: boolean = false; let actualWidth = ""; let actualHeight = ""; - let customDimensions = false; - let overflowFix = 0; - function updateDimensions(dimensions: HTMLDivElement) { + function updateDimensions() { /* we do not want the actual width, but rather the intended display width */ const widthAttribute = activeImage!.getAttribute("width"); customDimensions = false; @@ -78,22 +78,11 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } else { actualHeight = String(naturalHeight); } - - tick().then(() => { - const boundingClientRect = dimensions.getBoundingClientRect(); - const overflow = isRtl - ? window.innerWidth - boundingClientRect.x - boundingClientRect.width - : boundingClientRect.x; - - overflowFix = Math.min(0, overflowFix + overflow, overflow); - }); } - let dimensions: HTMLDivElement; - async function updateSizesWithDimensions() { updateSizes(); - updateDimensions(dimensions); + updateDimensions(); } /* window resizing */ @@ -224,18 +213,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html {/if} -
+ {actualWidth}×{actualHeight} - {#if customDimensions}(Original: {naturalWidth}×{naturalHeight}){/if} -
+ {#if customDimensions} + (Original: {naturalWidth}×{naturalHeight}) + {/if} +