From d6aa95950d8dcd0160c9137e7ce6db2feaf18507 Mon Sep 17 00:00:00 2001 From: Taylor Obyen <162023405+taylorobyen@users.noreply.github.com> Date: Wed, 2 Oct 2024 03:19:52 -0400 Subject: [PATCH 1/6] Fix occlusion drift again (#3443) * Fix occlusion drift * Fix image editor occasionally not loading fully * Fix occlusion disassociation when browsing * Address oversights * Fix translucent modifier applies to newly created shapes incorrectly * Fix i-text turns yellow upon immediate note change * Fix image occlusion hot keys not disabled when typing * Improve text label creation experience * Remove redundant functions * Fix error when adding occlusion (dae) --- qt/aqt/editor.py | 2 +- ts/editor/NoteEditor.svelte | 6 +-- .../image-occlusion/ImageOcclusionPage.svelte | 2 +- ts/routes/image-occlusion/MaskEditor.svelte | 40 +++++++++---------- ts/routes/image-occlusion/Toolbar.svelte | 37 ++++++++++------- ts/routes/image-occlusion/mask-editor.ts | 28 ++++++++----- ts/routes/image-occlusion/shapes/base.ts | 2 +- ts/routes/image-occlusion/shapes/text.ts | 3 +- ts/routes/image-occlusion/shapes/to-cloze.ts | 8 +--- ts/routes/image-occlusion/store.ts | 2 + .../image-occlusion/tools/from-shapes.ts | 6 ++- ts/routes/image-occlusion/tools/lib.ts | 25 +++++++++--- ts/routes/image-occlusion/tools/tool-text.ts | 17 +++----- .../image-occlusion/tools/tool-undo-redo.ts | 8 ++-- ts/routes/image-occlusion/tools/tool-zoom.ts | 9 +++-- 15 files changed, 111 insertions(+), 84 deletions(-) diff --git a/qt/aqt/editor.py b/qt/aqt/editor.py index 975780e4eb7..ebd1f50589c 100644 --- a/qt/aqt/editor.py +++ b/qt/aqt/editor.py @@ -1125,7 +1125,7 @@ def reset_image_occlusion(self) -> None: self.web.eval("resetIOImageLoaded()") def update_occlusions_field(self) -> None: - self.web.eval("updateOcclusionsField()") + self.web.eval("saveOcclusions()") def _setup_mask_editor(self, io_options: dict): self.web.eval( diff --git a/ts/editor/NoteEditor.svelte b/ts/editor/NoteEditor.svelte index 83ceec32871..885200e07d4 100644 --- a/ts/editor/NoteEditor.svelte +++ b/ts/editor/NoteEditor.svelte @@ -459,7 +459,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html } globalThis.setImageField = setImageField; - function updateOcclusionsField(): void { + function saveOcclusions(): void { if (isImageOcclusion && globalThis.canvas) { const occlusionsData = exportShapesToClozeDeletions($hideAllGuessOne); fieldStores[ioFields.occlusions].set(occlusionsData.clozes); @@ -572,7 +572,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html triggerChanges, setIsImageOcclusion, setupMaskEditor, - updateOcclusionsField, + saveOcclusions, ...oldEditorAdapter, }); @@ -637,7 +637,7 @@ the AddCards dialog) should be implemented in the user of this component.
diff --git a/ts/routes/image-occlusion/ImageOcclusionPage.svelte b/ts/routes/image-occlusion/ImageOcclusionPage.svelte index 4d4d38f3bbd..aad104ad656 100644 --- a/ts/routes/image-occlusion/ImageOcclusionPage.svelte +++ b/ts/routes/image-occlusion/ImageOcclusionPage.svelte @@ -40,7 +40,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html