diff --git a/frontend/src/components/floating-menus/ColorPicker.vue b/frontend/src/components/floating-menus/ColorPicker.vue index 9e2cf743..236938d2 100644 --- a/frontend/src/components/floating-menus/ColorPicker.vue +++ b/frontend/src/components/floating-menus/ColorPicker.vue @@ -135,7 +135,7 @@ export default defineComponent({ const hsva = this.color.toHSVA(); return { - draggingPickerTrack: undefined as HTMLElement | undefined, + draggingPickerTrack: undefined as HTMLDivElement | undefined, hue: hsva.h, saturation: hsva.s, value: hsva.v, diff --git a/frontend/src/components/floating-menus/DialogModal.vue b/frontend/src/components/floating-menus/DialogModal.vue index 6d79e042..1d9a58df 100644 --- a/frontend/src/components/floating-menus/DialogModal.vue +++ b/frontend/src/components/floating-menus/DialogModal.vue @@ -84,8 +84,8 @@ export default defineComponent({ }, mounted() { // Focus the first button in the popup - const element = this.$el as Element | undefined; - const emphasizedOrFirstButton = (element?.querySelector("[data-emphasized]") || element?.querySelector("[data-text-button]") || undefined) as HTMLButtonElement | undefined; + const dialogModal: HTMLDivElement | undefined = this.$el; + const emphasizedOrFirstButton = (dialogModal?.querySelector("[data-emphasized]") || dialogModal?.querySelector("[data-text-button]") || undefined) as HTMLButtonElement | undefined; emphasizedOrFirstButton?.focus(); }, components: { diff --git a/frontend/src/components/floating-menus/EyedropperPreview.vue b/frontend/src/components/floating-menus/EyedropperPreview.vue index c6a9ab75..cc2352c4 100644 --- a/frontend/src/components/floating-menus/EyedropperPreview.vue +++ b/frontend/src/components/floating-menus/EyedropperPreview.vue @@ -113,7 +113,9 @@ export default defineComponent({ }, methods: { displayImageDataPreview(imageData: ImageData | undefined) { - const canvas = this.$refs.zoomPreviewCanvas as HTMLCanvasElement; + const canvas = this.$refs.zoomPreviewCanvas as HTMLCanvasElement | undefined; + if (!canvas) return; + canvas.width = ZOOM_WINDOW_DIMENSIONS; canvas.height = ZOOM_WINDOW_DIMENSIONS; const context = canvas.getContext("2d"); diff --git a/frontend/src/components/floating-menus/MenuList.vue b/frontend/src/components/floating-menus/MenuList.vue index 4b2802f6..565e5e54 100644 --- a/frontend/src/components/floating-menus/MenuList.vue +++ b/frontend/src/components/floating-menus/MenuList.vue @@ -46,7 +46,7 @@ :direction="'TopRight'" :entries="entry.children" v-bind="{ minWidth, drawIcon, scrollableY }" - :ref="(ref: MenuListInstance) => ref && (entry.ref = ref)" + :ref="(ref: MenuListInstance): void => (ref && (entry.ref = ref), undefined)" /> @@ -204,15 +204,17 @@ const MenuList = defineComponent({ this.$emit("update:open", newIsOpen); }, entries() { - const floatingMenu = this.$refs.floatingMenu as typeof FloatingMenu; - floatingMenu.measureAndEmitNaturalWidth(); + (this.$refs.floatingMenu as typeof FloatingMenu | undefined)?.measureAndEmitNaturalWidth(); }, drawIcon() { - const floatingMenu = this.$refs.floatingMenu as typeof FloatingMenu; - floatingMenu.measureAndEmitNaturalWidth(); + (this.$refs.floatingMenu as typeof FloatingMenu | undefined)?.measureAndEmitNaturalWidth(); }, }, methods: { + scrollViewTo(distanceDown: number): void { + const scroller: HTMLDivElement | undefined = (this.$refs.scroller as typeof LayoutCol | undefined)?.$el; + scroller?.scrollTo(0, distanceDown); + }, onEntryClick(menuListEntry: MenuListEntry): void { // Call the action if available if (menuListEntry.action) menuListEntry.action(); @@ -242,7 +244,6 @@ const MenuList = defineComponent({ return this.open; }, - /// Handles keyboard navigation for the menu. Returns if the entire menu stack should be dismissed keydown(e: KeyboardEvent, submenu: boolean): boolean { // Interactive menus should keep the active entry the same as the highlighted one diff --git a/frontend/src/components/layout/FloatingMenu.vue b/frontend/src/components/layout/FloatingMenu.vue index 522389cd..aaeb1dfd 100644 --- a/frontend/src/components/layout/FloatingMenu.vue +++ b/frontend/src/components/layout/FloatingMenu.vue @@ -1,6 +1,6 @@