mirror of
https://github.com/ankitects/anki.git
synced 2025-11-13 08:07:11 -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() {
|
function resetSizes() {
|
||||||
|
activeImage = null;
|
||||||
|
|
||||||
top = 0;
|
top = 0;
|
||||||
left = 0;
|
left = 0;
|
||||||
width = 0;
|
width = 0;
|
||||||
height = 0;
|
height = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$: if (activeImage) {
|
|
||||||
updateSizes();
|
|
||||||
} else {
|
|
||||||
resetSizes();
|
|
||||||
}
|
|
||||||
|
|
||||||
let actualWidth = "";
|
let actualWidth = "";
|
||||||
let actualHeight = "";
|
let actualHeight = "";
|
||||||
let customDimensions = false;
|
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 sizeSelect: any;
|
||||||
let active = false;
|
let active = false;
|
||||||
|
|
||||||
|
$: if (activeImage && sizeSelect?.images.includes(activeImage)) {
|
||||||
|
updateSizes();
|
||||||
|
} else {
|
||||||
|
resetSizes();
|
||||||
|
}
|
||||||
|
|
||||||
function onDblclick() {
|
function onDblclick() {
|
||||||
sizeSelect.toggleActualSize();
|
sizeSelect.toggleActualSize();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -62,7 +62,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
return createPathRecursive([], element).join(" > ");
|
return createPathRecursive([], element).join(" > ");
|
||||||
}
|
}
|
||||||
|
|
||||||
let images: HTMLImageElement[] = [];
|
export const images: HTMLImageElement[] = [];
|
||||||
|
|
||||||
$: for (const [index, image] of images.entries()) {
|
$: for (const [index, image] of images.entries()) {
|
||||||
const rule = sheet.cssRules[index] as CSSStyleRule;
|
const rule = sheet.cssRules[index] as CSSStyleRule;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue