Only allow ImageHandle on valid pictures (determined in SizeSelect)

This commit is contained in:
Henrik Giesel 2021-08-04 19:13:37 +02:00 committed by Damien Elmes
parent 899434c682
commit 386e2740e6
2 changed files with 9 additions and 7 deletions

View file

@ -42,18 +42,14 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
}
function resetSizes() {
activeImage = null;
top = 0;
left = 0;
width = 0;
height = 0;
}
$: if (activeImage) {
updateSizes();
} else {
resetSizes();
}
let actualWidth = "";
let actualHeight = "";
let customDimensions = false;
@ -178,6 +174,12 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
let sizeSelect: any;
let active = false;
$: if (activeImage && sizeSelect?.images.includes(activeImage)) {
updateSizes();
} else {
resetSizes();
}
function onDblclick() {
sizeSelect.toggleActualSize();
}

View file

@ -62,7 +62,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
return createPathRecursive([], element).join(" > ");
}
let images: HTMLImageElement[] = [];
export const images: HTMLImageElement[] = [];
$: for (const [index, image] of images.entries()) {
const rule = sheet.cssRules[index] as CSSStyleRule;