Skip to content

Rotate direction on nodes without a direction tag - #23

Closed
tordans wants to merge 3 commits into
masterfrom
cursor/direction-rotate-default-north-d298
Closed

Rotate direction on nodes without a direction tag#23
tordans wants to merge 3 commits into
masterfrom
cursor/direction-rotate-default-north-d298

Conversation

@tordans

@tordans tordans commented Jul 8, 2026

Copy link
Copy Markdown
Owner

Superseded — implemented upstream in bryceco/GoMap#976:

  • cf0ca88 — Enable rotating nodes even if they don't have "direction" set yet (when applicable)
  • 9740281 — Move object rotation presentation into a new layer

See comment for a comparison of approaches.

User story

As a mapper, I want to rotate the facing direction of point features (e.g. surveillance cameras, traffic signs) using the map's Rotate action — even when I have not set a direction or camera:direction tag yet. If I open Rotate and then dismiss it without actually turning the object, no direction tag should be saved.

Solution

  • Rotate now appears in the context menu for point features whose preset supports a bearing-style direction or camera:direction field, even when that tag is empty.
  • Choosing Rotate shows a north-facing (0°) preview arrow so you can immediately turn the object with the rotation gesture.
  • The direction tag is written only after you actively rotate. Closing rotate mode without changing anything leaves the object unchanged.

Technical notes

  • Preview bearing is drawn from editor state only; tags are not written until the first rotation gesture movement.
  • The rotate target node is pinned when rotate mode starts so a mid-session selection change cannot tag the wrong feature.
Open in Web Open in Cursor 

cursoragent and others added 3 commits July 8, 2026 21:38
When a node's preset supports direction or camera:direction but no bearing
is set yet, show Rotate in the context menu. Entering rotate mode previews
north (0°) without writing a tag. The tag is only saved after the user
actually rotates; dismissing rotate mode leaves the object unchanged.

Co-authored-by: Tobias <[email protected]>
High: Direction rotation uses selectedNode at gesture time instead of the
node captured when rotate mode started. Selection can change while rotate
mode stays active (e.g. via POI list selectObject), so the wrong node may
receive another feature's direction tag and bearing.

Co-authored-by: Tobias <[email protected]>
Apply Opus 4.8 review feedback: capture the node when rotate mode starts
and apply tag updates to that node only. End rotate mode when selectObject
changes selection so a stale rotate session cannot tag the wrong feature.

Co-authored-by: Tobias <[email protected]>
@bryceco

bryceco commented Jul 10, 2026

Copy link
Copy Markdown

I haven't looked at this deeply, but I'm pretty sure this LLM generated code isn't the easiest/best way to approach this. There is probably a more direct solution that requires fewer new state variables, so while I won't accept this I'm open to doing something similar.

@cursor

cursor Bot commented Jul 27, 2026

Copy link
Copy Markdown

FYI — superseded by upstream implementation

This feature was implemented upstream in bryceco/GoMap#976 in two commits:

  1. cf0ca88Enable rotating nodes even if they don't have "direction" set yet (when applicable)
  2. 9740281Move object rotation presentation into a new layer

How this PR differs

This PR (#23) Upstream (cf0ca88 + 9740281)
Base Built on tordans/GoMap master without prior direction-rotation infra Builds on #957 (NodeDirectionState, unified rotateBegin/rotateContinue/rotateFinish)
Scope ~195 lines across 5 files; parallel rotateDirectionBegin/Continue/Finish path Core feature is ~37 lines in 2 files; extends existing prepareNodeRotation()
Eligibility OsmNode.rotatableDirectionTagKey extension; checks preset field type == .number; includeNSI: true EditorMapLayer.rotatableDirectionTagKeyFor(node:); any matching preset field; includeNSI: false
Default north Preview-only via directionShapeLayers editor state; tag written on first gesture OsmNode.Direction(0) in NodeDirectionState; same didMove guard for persistence
Rotation UX Ends when the two-finger gesture ends (old MapView gesture handler) RotateObjectOverlayViewController: multi-gesture rotation, tap-to-dismiss
Tests 6 new unit tests in OsmNode_DirectionTestCase No new tests in these commits

Functionally both solve the same user story (rotate without an existing tag, default north, no save on cancel). Upstream's approach is smaller because it extends existing abstractions rather than adding a parallel rotation path.

@tordans tordans closed this Jul 27, 2026
@tordans
tordans deleted the cursor/direction-rotate-default-north-d298 branch July 27, 2026 04:52
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.

3 participants