Add direction dial for numeric *:direction fields#12104
Add direction dial for numeric *:direction fields#12104tordans wants to merge 3 commits intoopenstreetmap:developfrom
*:direction fields#12104Conversation
This comment was marked as resolved.
This comment was marked as resolved.
|
Testing: Multiple values ✅ The dial is deactivated in this case. The cursor on hover on the dial is the "cannot do anything" cursor. Test-Link: https://pr-12104--ideditor.netlify.app/#disable_features=boundaries&map=20.01/54.20815/10.42527&background=Bing&locale=en&id=n-1,n-2 => Create a traffic sign for example. |
|
One question that was raised during development was, if we should extend the fields like https://github.com/openstreetmap/id-tagging-schema/blob/main/data/fields/direction.json with |
| options: DirectionFieldDialMountOptions | ||
| ): (fieldRoot: FormFieldRootSelection) => SyncDirectionDial { | ||
| if (!enabled) { | ||
| return function mountDisabled(fieldRoot: FormFieldRootSelection) { |
There was a problem hiding this comment.
Unsure about the way the code is split out from input.js. A function that returns a function is not ideal from a complexity point of view. But it does help to keep the changes to input.js small. Another option would be to inline this in input.js and look into extracting a bit of helper code out where possible.
| border-radius: 0; | ||
| } | ||
|
|
||
| .form-field-has-direction-dial { |
There was a problem hiding this comment.
As currently designed, the dial occupies the right end of the field’s header bar, insetting the bar to the left. This is a clever way to maximize the dial’s height while minimizing the overall field’s height. However, I’m concerned that inconsistent placement of the header bar could lead users to misclick. #12005 would add more buttons to the bar, making consistency even more desirable.
Since the dial can apparently track the cursor outside of its bounds, maybe we don’t really need to make the dial that big. But if we do, I think we could get away with just making the field taller. It would give us space for a Reverse Direction button similar to the one in the One Way field. I hit V all the time on directional features. For example, I’ll often map a traffic sign and duplicate it to represent the same sign facing the other side of the road.
There was a problem hiding this comment.
However, I’m concerned that inconsistent placement of the header bar could lead users to misclick.
…
Since the dial can apparently track the cursor outside of its bounds, maybe we don’t really need to make the dial that big. But if we do, I think we could get away with just making the field taller.
We can try this, but I do not expect it to look great.
- If the dial is just the height of the input, I expect it to be too small to feel like a nice UI; the shift-case would not look good either.
- Making the field bigger in height did look weird
- My ideal from
12005: I think we need to use a different place for those Buttons anyway (see Show and edit related subtags in the inspector (check_date,note/description,source,conditional, numeric, other) #12005 (comment)) and also the direction field should not have those extra options (its not something that usually has a side, subtags or similar. Maybe source.
It would give us space for a Reverse Direction button similar to the one in the One Way field. I hit V all the time on directional features. For example, I’ll often map a traffic sign and duplicate it to represent the same sign facing the other side of the road.
Like the idea. But we might want to track this separately. One idea I have is to remove the undo button, which AFAIR we only have for this field(?) and use that space for a new button. Or an inline "labe/button" in the field like the "reverse"-text-button for oneway.
|
Quick notes from a talk with @tyrasd at a meetup:
|

Closes #5530
Ping #9733, openstreetmap/id-tagging-schema#2081
This PR adds a dial control to the numeric direction fields.
Features:
incrementpropertyincrement(in the video that is 5)Site note: The
incrementfeatures works differently on the dial than on the+/-buttons. The buttons increase in +/- steps so 3 becomes 3+5=7. The dial jumps to either 5 or 10. — I think this inconsistency is OK. We keep the backward compatibility for the buttons and the dial works more natural like this IMO.Video:
Bildschirmaufnahme.2026-03-25.um.18.32.54.mov
This code is created using LLM tools. I reviewed it and iterated on it for a while to get into a shape that I find easy to understand and that has a clean split between the existing features and the new additions.
Regardless, I will keep this as a draft first so we can discuss the UX and possible edge cases that I missed, first. But if anyone want to, the code can be reviewed from my point of view.