Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nk-coding
Copy link
Contributor

  • excalidraw-inspired snapping for
    • element/point translate move
    • resize (partial)
    • create new element
    • edit axis-aligned segment

@nk-coding nk-coding requested a review from Copilot April 30, 2025 01:44
Copy link

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 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 {

@nk-coding nk-coding merged commit 8524f7d into main Apr 30, 2025
2 checks passed
@nk-coding nk-coding deleted the feature/snapping branch April 30, 2025 10:46
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.

2 participants