Plots2: Turn off scrollwheel zooming for inline maps?

Created on 9 Jan 2020  路  12Comments  路  Source: publiclab/plots2

Hi @sagarpreet-chadha @nstjean - a colleague pointed out that scrolling down this page is tough with a scroll wheel because it starts zooming the map. I would guess scrollwheel zooming is usually turned off for maps like these that are full width? But I'm not sure. What do you think we should do?

https://publiclab.org/wiki/unearthing-pvd

Thanks!

discussion help wanted

Most helpful comment

Ok thnx @nstjean I will try.

All 12 comments

I noticed that on one of the example pages you showed me. I think turning off scrollwheel zooming for these situations would be a good idea.

@jywarren I would like to work on this.
I have an idea, instead of scrolling we can add button for zoom in the maps.
What is your review?
thanks

@NitinBhasneria There should already be zoom in and out buttons on the maps. :) We just need to turn off the scrollwheel!

@nstjean so should I make this happen?

@NitinBhasneria If you feel like this is something you can do, then go ahead and try it! Just ask for help if you get stuck!

Ok thnx @nstjean I will try.

@nstjean can you please tell me where is the code of map situated? I cant find it.

This is the file that has the fullwidth inline map:
https://github.com/publiclab/plots2/blob/master/app/views/map/_inlineLeaflet.html.erb

You'll have to find in Leaflet how to turn off scrollwheel zoom, I think they must have a setting for it. Here's the docs:
https://leafletjs.com/reference-1.6.0.html

And then you'll use that setting when the map is created on the page with L.map

Yes it is straightforward, just pass {scrollWheelZoom: false} in options in L.map instantiation!
https://leafletjs.com/reference-1.6.0.html#map-scrollwheelzoom

@sagarpreet-chadha Can you suggest where I can find the code for this..?

So here is the code where L.map is called:
https://github.com/publiclab/plots2/blob/d4f803c1dba59f91c5d8eb6e21b9e2c218b94372/app/views/map/_inlineLeaflet.html.erb#L32-L38

you'll have to add an option in the list
scrollWheelZoom: false

Thnx @nstjean

Was this page helpful?
0 / 5 - 0 ratings

Related issues

cesswairimu picture cesswairimu  路  119Comments

gautamig54 picture gautamig54  路  84Comments

sagarpreet-chadha picture sagarpreet-chadha  路  72Comments

jywarren picture jywarren  路  85Comments

jywarren picture jywarren  路  98Comments