Skip to content

Improve ruler button toggle#1801

Open
AussieTraccar wants to merge 3 commits into
traccar:masterfrom
AussieTraccar:improve_ruler_button_toggle
Open

Improve ruler button toggle#1801
AussieTraccar wants to merge 3 commits into
traccar:masterfrom
AussieTraccar:improve_ruler_button_toggle

Conversation

@AussieTraccar
Copy link
Copy Markdown
Contributor

Purpose: The map ruler button is difficult to identify when it is active or inactive, as the colour difference between the two states is very similar.

Solution: This PR implements a distinct colour change between inactive state; black on white (default icon colour) and active state; white on black (reversed icon colour). This PR also supports eliminating touch screen hover stickiness for mobile devices.

@tananaev
Copy link
Copy Markdown
Member

Please provide screenshots before and after.

@AussieTraccar
Copy link
Copy Markdown
Contributor Author

eventListener_mouse_exit

Thinking about it, the eventListener is not the best way to go about it, as ruler button is slightly dimmed with mouse exit.

Will revisit without eventListeners.

@AussieTraccar
Copy link
Copy Markdown
Contributor Author

Screenshots of before and after.

Ruler button (Before): Idle -> mouse enter -> active

ruler_toggle-before

Ruler button (After): Idle -> mouse enter -> active

ruler_toggle-after

@tananaev
Copy link
Copy Markdown
Member

I don't know if this design makes sense. Current one is the standard MapLibre uses for all controls. For example drawing controls.

@AussieTraccar
Copy link
Copy Markdown
Contributor Author

AussieTraccar commented May 16, 2026

I would have thought it falls under the Maplibre toggle interactions, which was why I initially did it with eventListeners, but it didn't quite maintain your established theme.

From a user experience perspective, it provides visual clarity with the action. The other map controls also provide some visual clarity with pop-out fields dialogs etc. Seemingly trivial interactions like this, can contribute to the overall user experience.

@tananaev
Copy link
Copy Markdown
Member

Not sure I understand the point you're trying to make. There's already a selected state.

@AussieTraccar
Copy link
Copy Markdown
Contributor Author

Maybe I am missing something, but what is the selected state difference?

All of the map controls, with the exception of the ruler button, provide feedback to the user when the button has been selected (e.g. switcher -> map selection pop-up and geocoder -> search pop-up). The ruler button provides no feedback to the user when it is selected. This PR provides that feedback, for when the button has been selected.

I hope that makes a bit more sense?

@tananaev
Copy link
Copy Markdown
Member

Deselected Selected
Screenshot 2026-05-16 at 6 50 34 AM Screenshot 2026-05-16 at 6 50 41 AM

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.

2 participants