openbikesensor / portal

OpenBikeSensor data collection portal
GNU Lesser General Public License v3.0
37 stars 17 forks source link

Improve Map controls, attribution and viewport history #278

Closed opatut closed 2 years ago

sonarcloud[bot] commented 2 years ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

gluap commented 2 years ago

As it was ui-only I rolled it out on https://obs.adfc-darmstadt.de for testing. The disappearing attribution brought up in #272 is now nice and visible again as it should be. The close button on the roads overlay for #275 works like a charm and I can't reproduce #274 with the new version. Regarding #276 the debouncing still may write a bunch of history entries a minute - maybe the easiest way to debounce for scrolling would be onMouseUp or similar if that event could be used to trigger the address bar rewrite? It seems that is what Google/Openstreetmap are at least listening to that event and for scrolling their url updates whenever one mouseups while dragging. Also it's unlikely that anyone is copying from the address bar while mouse-downing on the map. Nevertheless I see nothing broken about this merge request, so would suggest merging to fix #272 in a timely manner.

opatut commented 2 years ago

maybe the easiest way to debounce for scrolling would be onMouseUp or similar if that event could be used to trigger the address bar rewrite

Sadly, no, as other events also move the viewport, and you'd have to listen to all of them: clicking, double clicking, arrow keys?, scrolling, the navigation controls... It is easiest this way. Also, debounce means that if within 200ms there is another movement, it is ignored. It will not change the URL every 200ms while you're dragging, if that's what you thought. It will change the URL when you're not moving for 200ms. Most people will release the mouse when they stop dragging around anyway, and then click again to continue moving, if they so desire. I think it makes very little difference, you'll usually get one history entry per move either way.