Skip to content

Conversation

@mxgrey
Copy link
Collaborator

@mxgrey mxgrey commented Nov 11, 2025

This PR is an alternative to #402 that generalizes the alignment feature to work on all anchor-related types: points, edges, and paths. Besides allowing edges and paths to be aligned with the x/y axes, this also allows all three types to be aligned with any edges that exist near the cursor. When an edge is being aligned against, the support hovering outline will be activated for it to indicate to the user which edge is being used for alignment.

The most key difference between this and #402 is that I've expanded the way the continuous service select_anchor_cursor_transform is implemented to account for alignment settings which can be toggled from a CreationSettings resource. A separate scheduled system tracks the left shift button to toggle CreationSettings::alignment_on. We can expand the CreationSettings resource in the future to allow users to toggle on/off aligning/snapping to edges, floors, sequences of models, intersections, etc.

For now alignment is only implemented against edges and the x/y axes. It would be fairly easy to expand the implementation to consider path (floor) segments and sequences of objects (such as models).

(EDIT: Finished already) One point that could be improved for the UX might be a different "cost" function for deciding which element to align against. Currently we select the element that would require the smallest change in cursor position to achieve alignment, but we should probably factor in how close that element is to the cursor or else the cost function will tend to select elements that are far away but just happen to align closely to the cursor. We could try a cost function along the lines of delta_cursor / distance_to_element.

@mxgrey mxgrey requested a review from xiyuoh November 11, 2025 17:52
@mxgrey mxgrey added this to PMC Board Nov 11, 2025
@github-project-automation github-project-automation bot moved this to Inbox in PMC Board Nov 11, 2025
Signed-off-by: Michael X. Grey <[email protected]>
Signed-off-by: Michael X. Grey <[email protected]>
@mxgrey
Copy link
Collaborator Author

mxgrey commented Nov 12, 2025

I've just pushed two more tweaks:

  • When the alignment system is choosing to align with the x or y axis, the infinite grid will be highlighted as if it's being hovered
  • The cost function for choosing which element to align with has been updated to be more sticky (preferring to remain aligned with the last chosen element) and more sensitive to distance (preferring to align with nearby elements over far away elements)

Signed-off-by: Michael X. Grey <[email protected]>
@aaronchongth aaronchongth moved this from Inbox to In Progress in PMC Board Nov 18, 2025
@xiyuoh
Copy link
Member

xiyuoh commented Nov 20, 2025

Played around with these changes and I really like the ability to create new edges that align with the most recently created edge in continuous mode. This proves to be very useful when making floors/walls for sites that are non-rectangular, or has long edges that do not necessarily align with the x/y axes, since we often need multiple anchors along these edges.

I found an edge case where align_point wasn't able to snap to the x/y axis, and can only align with the previous element, wondering if this was intentional. Steps to reproduce:

  • Create a wall segment
  • Press Esc once to exit continuous creation mode (after this, you should be able to align point with all three options)
  • Press Esc again to exit wall creation mode
  • Select the Create Wall button on the top menu bar

@aaronchongth aaronchongth moved this from In Progress to In Review in PMC Board Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Review

Development

Successfully merging this pull request may close these issues.

3 participants