BiologicalRecordsCentre / iRecord

Repository to store and track enhancements, issues and tasks regarding the iRecord website.
http://irecord.org.uk
2 stars 1 forks source link

Change wheelie-mouse Zoom on the Maps to require the Ctrl key (recommendation) #415

Closed DavidHepper closed 5 years ago

DavidHepper commented 6 years ago

Google Maps now allows the developer to require that the Control (Ctrl) key be pressed for map zoom to occur. This works a treat. In iRecord a page is almost always longer than my screen. It drives me to distraction that I can scroll the page vertically using the mouse wheel but as soon as I hit a map the effect changes to zooming the map instead. I end up anywhere from Russia to St.Helena. Other verifiers agree. ( Originally reported in the iRecord Forum here ) Please! David

johnvanbreda commented 6 years ago

We don't use Google Maps JavaScript API, only the Google Maps layers inside Open Layers (a subtle but important distinction). So the options for Google Maps don't apply here. We could, however, change our mapping code so scroll wheel zoom defaults to disabled, either globally, or just on the verification. I'm not sure how useful a feature it is given the potential for it causing problems you have described. I'll wait for @kitenetter to comment on the preferred approach.

DavidHepper commented 5 years ago

@kitenetter Could we have a decision here? Random map zooms are still really annoying.

kitenetter commented 5 years ago

@johnvanbreda shame the ctrl key option isn't available, because I do find it useful to be able to zoom in and out of the maps using the mouse wheel, but I also recognise the difficulty that @DavidHepper highlights, and I think that the difficulty outweighs the convenience.

So I agree, let's disable the scroll wheel zoom.

JimBacon commented 5 years ago

It is more work but there is the possibility of overriding the current zoom function and inserting a conditional statement checking whether the control key is depressed.

An example of the function being overridden (for another purpose) is shown at https://stackoverflow.com/questions/23836895/openlayers-zoom-scroll-events-are-ignored-if-no-layers-are-visible

The source code has been moved on Github to https://github.com/openlayers/ol2/blob/master/lib/OpenLayers/Handler/MouseWheel.js

Another thought was to have a button on the map to allow scroll-wheel zooming to be turned on and off

johnvanbreda commented 5 years ago

I found a nice easy way to implement this so that you need to hold Ctrl to get the scroll wheel zoom to work using a keyMask propery on the MouseWheel handler. So, this is fixed ;)

DavidHepper commented 5 years ago

Perfect! Such a relief. It could just do with a matching edit to the mouseover help for the Navigation icon to say that Ctrl+MouseWheel is needed for map scroll. Might there be any other help doc to update?

johnvanbreda commented 5 years ago

Hi @DavidHepper, I've updated the navigation icon hint in the develop branch of the code, so it will be updated on the live site at some point.