Skip to content

Desktop: Whiteboard: Place new groups in empty space instead of viewport centre - #15901

Merged
laurent22 merged 2 commits into
devfrom
whiteboard_group_handling
Jul 13, 2026
Merged

Desktop: Whiteboard: Place new groups in empty space instead of viewport centre#15901
laurent22 merged 2 commits into
devfrom
whiteboard_group_handling

Conversation

@laurent22

Copy link
Copy Markdown
Owner

New groups used to spawn dead-centre at a fixed 480×400, often on top of existing nodes — which then became captives of the group and had to be dragged out before the group could be moved.

Now the placement searches for an empty spot near the viewport centre, spiralling outward and shrinking from a preferred 320×240 down to a 100×100 minimum. If nothing fits in view, the group is placed adjacent to the existing-nodes bounding box (with a gap) on whichever side is closest to the viewport, so it stays partially visible.

Logic is extracted to packages/lib/services/whiteboard/findEmptySpot.ts with unit tests.

@coderabbitai coderabbitai Bot added desktop All desktop platforms enhancement Feature requests and code enhancements labels Jul 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

.

Comment thread packages/lib/services/whiteboard/findEmptySpot.ts Outdated
@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Jul 13, 2026
@coderabbitai coderabbitai Bot added the bug It's a bug label Jul 13, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

.

@joplin-coderabbit-cleanup joplin-coderabbit-cleanup Bot deleted a comment from coderabbitai Bot Jul 13, 2026
@laurent22
laurent22 merged commit 5178633 into dev Jul 13, 2026
26 checks passed
@laurent22
laurent22 deleted the whiteboard_group_handling branch July 13, 2026 12:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug It's a bug desktop All desktop platforms enhancement Feature requests and code enhancements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant