Skip to content

Commit 6a70152

Browse files
authored
Wheel Selection Toolbox and Popover (#5781)
This pull request updates event handling in the selection toolbox components to ensure that mouse wheel events are properly forwarded to the canvas, improving interaction consistency across the UI. **Event handling improvements:** * Changed the wheel event handler in `SelectionToolbox.vue` to use `canvasInteractions.forwardEventToCanvas` instead of `canvasInteractions.handleWheel`, ensuring wheel events are consistently forwarded to the canvas. * Added the wheel event handler to the `MoreOptions.vue` popover, forwarding wheel events to the canvas for submenu interactions. **Code organization updates:** * Imported `useCanvasInteractions` in `MoreOptions.vue` to access the new event forwarding method. * Instantiated `canvasInteractions` in `MoreOptions.vue` for use in event handling.## Summary https://github.com/user-attachments/assets/46046086-35e8-4cd1-a11a-365705beb9cd ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-5781-Wheel-Selection-Toolbox-and-Popover-27a6d73d3650812c9c4fe8440ff7dd1d) by [Unito](https://www.unito.io)
1 parent 5c1e00f commit 6a70152

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

src/components/graph/SelectionToolbox.spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -450,9 +450,9 @@ describe('SelectionToolbox', () => {
450450
describe('Event Handling', () => {
451451
it('should handle wheel events', async () => {
452452
const mockCanvasInteractions = vi.mocked(useCanvasInteractions)
453-
const handleWheelSpy = vi.fn()
453+
const forwardEventToCanvasSpy = vi.fn()
454454
mockCanvasInteractions.mockReturnValue({
455-
handleWheel: handleWheelSpy
455+
forwardEventToCanvas: forwardEventToCanvasSpy
456456
} as any)
457457

458458
const mockExtensionService = vi.mocked(useExtensionService)
@@ -467,7 +467,7 @@ describe('SelectionToolbox', () => {
467467
const panel = wrapper.find('.panel')
468468
await panel.trigger('wheel')
469469

470-
expect(handleWheelSpy).toHaveBeenCalled()
470+
expect(forwardEventToCanvasSpy).toHaveBeenCalled()
471471
})
472472
})
473473

src/components/graph/SelectionToolbox.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
header: 'hidden',
1414
content: 'p-1 h-10 flex flex-row gap-1'
1515
}"
16-
@wheel="canvasInteractions.handleWheel"
16+
@wheel="canvasInteractions.forwardEventToCanvas"
1717
>
1818
<DeleteButton v-if="showDelete" />
1919
<VerticalDivider v-if="showInfoButton && showAnyPrimaryActions" />

src/components/graph/selectionToolbox/MoreOptions.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
:pt="pt"
2727
@show="onPopoverShow"
2828
@hide="onPopoverHide"
29+
@wheel="canvasInteractions.forwardEventToCanvas"
2930
>
3031
<div class="flex flex-col p-2 min-w-48">
3132
<MenuOptionItem
@@ -66,6 +67,7 @@ import {
6667
useMoreOptionsMenu
6768
} from '@/composables/graph/useMoreOptionsMenu'
6869
import { useSubmenuPositioning } from '@/composables/graph/useSubmenuPositioning'
70+
import { useCanvasInteractions } from '@/renderer/core/canvas/useCanvasInteractions'
6971
import { useMinimap } from '@/renderer/extensions/minimap/composables/useMinimap'
7072
7173
import MenuOptionItem from './MenuOptionItem.vue'
@@ -84,7 +86,7 @@ const currentSubmenu = ref<string | null>(null)
8486
8587
const { menuOptions, menuOptionsWithSubmenu, bump } = useMoreOptionsMenu()
8688
const { toggleSubmenu, hideAllSubmenus } = useSubmenuPositioning()
87-
89+
const canvasInteractions = useCanvasInteractions()
8890
const minimap = useMinimap()
8991
const containerStyles = minimap.containerStyles
9092

0 commit comments

Comments
 (0)