-
Notifications
You must be signed in to change notification settings - Fork 3
Feature/snapping #119
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature/snapping #119
Conversation
nk-coding
commented
Apr 30, 2025
- excalidraw-inspired snapping for
- element/point translate move
- resize (partial)
- create new element
- edit axis-aligned segment
There was a problem hiding this 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 introduces snapping functionality inspired by Excalidraw for various operations including element/point translation, resize, creation, and axis‐aligned segment editing. Key changes include the addition of snapping models and configuration, updates to move handler signatures to support snap line generation, and the renaming/adaptation of various move handler classes to integrate snapping support.
Reviewed Changes
Copilot reviewed 47 out of 49 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/diagram-ui/src/features/snap/model.ts | New type definitions and interfaces for snapping functionality |
| packages/diagram-ui/src/features/snap/di.config.ts | DI configuration for snap-related services |
| packages/diagram-ui/src/features/move/moveHandler.ts | Updated move handler abstract method to return handleMove result with optional snap lines |
| packages/diagram-ui/src/features/create-connection/createConnectionMoveHandler.ts | Moved from generateEdits to handleMove for consistency |
| packages/diagram-ui/src/features/canvas-content-move-edit/movedElementsSelector.ts | Added implicit moved elements tracking |
| packages/diagram-ui/src/features/canvas-content-move-edit/moveEditCanvasContentMouseListener.ts | Updated imports and handler invocations to support snap handlers |
| packages/diagram-ui/src/features/canvas-content-move-edit/handler/* | Various move handlers updated to support snapping and renamed for clarity (e.g. RotationMoveHandler, TranslationMoveHandler, AxisAlignedSegmentEditMoveHandler) |
| packages/diagram-protocol/src/diagram/editor-config/editorConfig.ts | Extended editor config with snapping and grid options |
| packages/diagram-common/src/model/elements/root.ts & common files | Updated to include transaction state and additional utility functions |
Files not reviewed (2)
- packages/diagram-ui/LICENSES: Language not supported
- packages/diagram-ui/css/hylimo.css: Language not supported
Comments suppressed due to low confidence (1)
packages/diagram-ui/src/features/canvas-content-move-edit/handler/axisAlignedSegmentEditMoveHandler.ts:23
- The class name 'AxisAligedSegmentEditMoveHandler' appears to be misspelled; consider renaming it to 'AxisAlignedSegmentEditMoveHandler' for consistency and clarity.
export class AxisAligedSegmentEditMoveHandler extends MoveHandler {