Skip to content

fix: constrained move mode improvements#10026

Open
mikeharv wants to merge 2 commits into
RaspberryPiFoundation:mainfrom
mikeharv:drag-fixes
Open

fix: constrained move mode improvements#10026
mikeharv wants to merge 2 commits into
RaspberryPiFoundation:mainfrom
mikeharv:drag-fixes

Conversation

@mikeharv

@mikeharv mikeharv commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The basics

The details

Resolves

Fixes #10023 #10024 #10025

Proposed Changes

This updates determineConnectionOffset() and updateConnectionPreview() in order to resolve three separate bugs.

  1. When determine the connection offset for a drag, use local.getOffsetInBlock() instead of local.x/local.y.
  2. Hide connection previews and reset connectionCandidate before calculating block position on workspace.
  3. Ignore dragging block when considering bounds of other blocks when calculating the same position.
  4. Horizontally align blocks moved to workspace with their most recent connection instead of the left edge of all blocks.

Reason for Changes

  1. When blocks are inserted from the toolbox, their RenderedConnection.x and RenderedConenction.y values have not been set and are equal to the coordinates of the block itself. This causes the block to be positioned incorrectly. See Block moved to bad position when inserting from toolbox #10023
image

2-3. Blocks were being moved onto the workspace further down than was necessary because the size of the content was influenced by the prior block position. By first hiding the preview and filtering out the dragging block from the content, we can get accurate bounds. See #10025

Imageimage

  1. By moving the block below the previous connection, we effectively guarantee that moving the block back up will result in moving to the last connection as expected. This solution is consistent screen reader mode enabled and disabled. See Moving blocks to closest connection is confusing when moving from below-blocks workspace position #10024
image image

This also adds a slight indent to the position of statements as the nextConnection of a block is slightly offset:
image

@mikeharv mikeharv requested a review from a team as a code owner June 17, 2026 19:01
@mikeharv mikeharv requested a review from gonfunko June 17, 2026 19:01
@github-actions github-actions Bot added the PR: fix Fixes a bug label Jun 17, 2026
@github-actions github-actions Bot added PR: fix Fixes a bug and removed PR: fix Fixes a bug labels Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

PR: fix Fixes a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Block moved to bad position when inserting from toolbox

2 participants