Skip to content

Conversation

@GeneralGDA
Copy link
Contributor

This pull request enhances the drawing module with improved tool selection logic and adds support for middle mouse button panning. It also introduces a new callback to notify when the drawing tool changes, and ensures the UI stays in sync with tool state changes. Additionally, new tests have been added to cover the updated tool selection behavior.

Drawing tool selection and state management:

  • Added a toolChanged callback to DrawingProps and integrated it into the drawing logic, so consumers are notified whenever the active tool changes. This is now used in both DrawingBoard.svelte and DrawingBoardEditor.svelte to keep their tool state in sync with the drawing module. [1] [2] [3]
  • Improved tool switching: when switching away from the pan tool, the previous tool is restored, and changing the pen color while in pan mode automatically switches back to the pen tool. [1] [2]

Middle mouse button panning:

  • Added enableMiddleMousePanning to DrawingProps and implemented logic to allow panning with the middle mouse button when enabled. This includes new pointer event handling and force-pan logic in the drawing module. [1] [2] [3] [4] [5]
  • Updated the drawing logic to distinguish between normal tool actions and forced panning, ensuring correct behavior for pointer and touch events. [1] [2] [3] [4] [5]

Testing:

  • Added a new test to verify that selecting a color after panning correctly switches back to the pen tool and triggers the toolChanged callback.

Minor code cleanup:

  • Removed an unused import from DrawingBoardEditor.svelte.

…or selection.

Signed-off-by: Denis Gladkiy <denis.gladkiy@hardcoreeng.com>
Signed-off-by: Denis Gladkiy <denis.gladkiy@hardcoreeng.com>
@GeneralGDA GeneralGDA requested a review from Copilot October 21, 2025 13:04
@huly-github-staging
Copy link

Connected to Huly®: UBERF-13965

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR refines the drawing board controls by adding middle mouse button panning support and improving tool state synchronization. The changes ensure that tool selection logic correctly handles transitions between pan and other tools, and that UI components stay in sync with internal tool state changes through a new callback mechanism.

  • Added toolChanged callback to notify consumers when the active drawing tool changes
  • Implemented middle mouse button panning with enableMiddleMousePanning flag
  • Enhanced tool switching to restore previous tool when exiting pan mode and auto-switch from pan to pen when changing pen color

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
plugins/text-editor-resources/src/components/DrawingBoardEditor.svelte Removed unused import, enabled middle mouse panning, and added toolChanged callback
packages/presentation/src/drawing.ts Added middle mouse button panning logic, tool state tracking, and toolChanged callback
packages/presentation/src/components/DrawingBoard.svelte Disabled middle mouse panning and added toolChanged callback
packages/presentation/src/___tests___/drawing.test.ts Added test for color selection after panning to verify tool switching behavior

@GeneralGDA GeneralGDA merged commit 0ee7e4e into develop Oct 21, 2025
15 checks passed
@GeneralGDA GeneralGDA deleted the drawing-board-control-refinement branch October 21, 2025 13:48
aonnikov pushed a commit that referenced this pull request Oct 22, 2025
* Drawing toolbar controls switching: return pen, after panning and color selection.

Signed-off-by: Denis Gladkiy <denis.gladkiy@hardcoreeng.com>

* Middle mouse button panning.

Signed-off-by: Denis Gladkiy <denis.gladkiy@hardcoreeng.com>

---------

Signed-off-by: Denis Gladkiy <denis.gladkiy@hardcoreeng.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants