mirror of
https://github.com/ankitects/anki.git
synced 2025-11-12 23:57:13 -05:00
Only allow ImageHandle on valid pictures (determined in SizeSelect)
This commit is contained in:
parent
899434c682
commit
386e2740e6
2 changed files with 9 additions and 7 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue