Add rotate action for points with direction - #12673
Conversation
245d792 to
ed350d5
Compare
capacitydirection
tyrasd
left a comment
There was a problem hiding this comment.
Nice, thanks. The only thing I noticed at first while playing around with it was that the operation is using the angle relative to the mouse position at the start of the operation, instead of just snapping it to the absolute direction the mouse points to. This could be a little counterintuitive maybe (e.g. where you need to draw), but I'd say we should probably leave it like this for consistency to the rotate operation for areas and lines (where there no absolute direction really exists which the feature can be directly rotated to), but maybe we could add a modifier key like Shift which toggles the relative to absolute mode? Does not need to be done in this PR immediately, though. Just wanted to find out about what your opinion on this idea.
One additional quality of life improvement would be to be able to start setting a direction on such a vertex by pressing R even if the tag was previously absent. This could be allowed when the preset has a field for the direction tag in fields or moreFields.
During rotate, the sidebar stays on the feature
Good catch! I also never noticed it until now, but it was definitely a bug.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Allow R to adjust camera:direction and other numeric *:direction tags, including on way vertices and when the tag is still absent on the preset. Point direction always follows the mouse azimuth. Ping openstreetmap#12673 Co-authored-by: Cursor <cursoragent@cursor.com>
49c8cfd to
778675e
Compare
Allow R to adjust camera:direction and other numeric *:direction tags, including on way vertices and when the tag is still absent on the preset. Point direction always follows the mouse azimuth. Ping openstreetmap#12673 Co-authored-by: Cursor <cursoragent@cursor.com>
Allow R to adjust camera:direction and other numeric *:direction tags, including on way vertices and when the tag is still absent on the preset. Point direction always follows the mouse azimuth. Ping openstreetmap#12673 Co-authored-by: Cursor <cursoragent@cursor.com>
778675e to
c9942c3
Compare
| * when false, match relative fields used by reverse (`forward`/`backward`). | ||
| * @returns false or the direction tag key | ||
| */ | ||
| export function utilDirectionFieldKey( |
There was a problem hiding this comment.
FYI Context:
utilDirectionFieldKeyis the oldsupportsDirectionFieldhelper moved out ofreverse.tsand parameterized.For reverse (
numeric: false) the behavior is unchanged: same presetfields/moreFieldsscan, samedirection/*:directionkey check, same geometry filter, still only non-number(relative) fields.
numeric: trueis the new path for rotate (angle fields). Key matching now goes through sharedutilIsDirectionKey, which is equivalent for the reverse case.
Let the existing rotate operation adjust direction=* on standalone points so the on-map direction cone can be edited without a separate UI. Co-authored-by: Cursor <cursoragent@cursor.com>
Pass the next mode into exit so select can skip hiding the sidebar when entering rotate, and rotate only hides when leaving the selection. Co-authored-by: Cursor <cursoragent@cursor.com>
Surface that R adjusts numeric direction=* on the map in the field's info panel, matching the existing comment-docs special case pattern. Co-authored-by: Cursor <cursoragent@cursor.com>
Clarify that R adjusts numeric direction=* for points in the help Operations text, the keyboard shortcuts panel, and the rotate tooltip. Co-authored-by: Cursor <cursoragent@cursor.com>
Allow R to adjust camera:direction and other numeric *:direction tags, including on way vertices and when the tag is still absent on the preset. Point direction always follows the mouse azimuth. Ping openstreetmap#12673 Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid advertising R on relative direction tags like forward/backward where point-direction rotate is unavailable. Co-authored-by: Cursor <cursoragent@cursor.com>
Match geometry rotate: a transform change should not snap the direction tag to the current mouse bearing until the user actually moves again. Co-authored-by: Cursor <cursoragent@cursor.com>
6a7379d to
4ad1464
Compare
|
FYI — updates since the last review (history was rebased/amended onto Addressed the review feedback and a few follow-ups:
Compared against the old tip |
k-yle
left a comment
There was a problem hiding this comment.
very cool! sorry i have another few questions
| degrees: number, | ||
| key?: TagKey | ||
| ): Action { | ||
| return function(graph) { |
There was a problem hiding this comment.
for two-sided features, pressing R will destroy the two-sidedness. for example: direction=120;300

i think it should either:
- preseve the sidedness - if there were 2 angles offset by 180degrees before rotating, then it should rotate both angles, still offset by 180degrees.
- or; block the operation in this situation
| describe('iD.utilDirectionFieldKey / iD.utilRotatePointDirectionKey', () => { | ||
| beforeEach(() => { | ||
| const cached: any = iD.fileFetcher.cache(); | ||
| cached.preset_fields = { |
There was a problem hiding this comment.
currently there is exactly 1 file that overrides preset_fields, now we have multiple files mutating a global state.
i'm not sure if this will cause a race condition because we use --no-isolate? i guess we'll find out...
| }); | ||
|
|
||
| it('finds a numeric direction field on the preset', async () => { | ||
| await (iD.presetManager as any).ensureLoaded(true); |
There was a problem hiding this comment.
fixed in #12683, i'll update it if this PR is merged first
|
|
||
| for (const key of Object.keys(node.tags)) { | ||
| if (!utilIsDirectionKey(key)) continue; | ||
| if (!isFinite(Number(node.tags[key]))) continue; |
There was a problem hiding this comment.
this will reject any cardinal value (see list here).
Since #9141, the field's ⬆️/⬇️ buttons support these values, so the action should probably support it?





Testing:
This is a subset of #12104.
The PR only add the
RShortcut that we explored over there, plus some context.The idea is: This change is a lot simpler than #12104 but it bringt us a long way to improve the UX for editing node
directions.Changes:
Rfor nodes withdirectiontagCloses #12341
Aside: This idea was also adopted to GoMap where it works great, IMO
🤖 the changes are build with Cursor Models and reviewed by me.