Skip to content

tiles: Fix resize not snapping to other panels#2481

Closed
ylinwind wants to merge 2 commits into
mainfrom
fix/tiles-resize-snap
Closed

tiles: Fix resize not snapping to other panels#2481
ylinwind wants to merge 2 commits into
mainfrom
fix/tiles-resize-snap

Conversation

@ylinwind

Copy link
Copy Markdown
Contributor

Description

Resizing a tile did not magnetically snap to neighboring panels, even though dragging (moving) a tile did.

The resize handles already computed the snapped edge via calculate_resize_edge_snap, but resize() then called round_to_nearest_ten() on x/y/width/height every frame. With tile_grid_size = 8px, this quantized the snapped value back onto the grid, so the snap to another panel's edge was overridden/invisible. Dragging worked because update_position deliberately snaps without per-frame rounding ("smooth dragging") and only aligns to the grid on mouse up.

This PR makes resize symmetric with drag:

  • resize() now applies the (already snapped) values directly, without per-frame grid rounding.
  • Grid alignment is applied once on mouse up, mirroring the drag behavior.
  • Removed the now-unused pub(crate) panel() helper.

No performance impact — this removes per-frame rounding work from the resize hot path; the snap logic is O(n) per frame, the same as the existing drag snap.

🤖 Generated with Claude Code

Resize handles already computed the magnetic snap edge, but `resize()`
applied `round_to_nearest_ten()` on every frame, quantizing the snapped
value back to the grid so the snap to neighboring panels was invisible.
Dragging works because `update_position` snaps without per-frame rounding.

Make resize symmetric with drag: apply snapped values directly while
resizing and align to the grid on mouse up. Also remove the now-unused
`panel()` helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@ylinwind ylinwind force-pushed the fix/tiles-resize-snap branch from 4ff007c to 54d466d Compare June 22, 2026 03:27
@ylinwind ylinwind closed this Jun 23, 2026
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.

1 participant