EventDrops icon indicating copy to clipboard operation
EventDrops copied to clipboard

Is there a way to restrict the range you can scroll to.

Open geoffoddie opened this issue 7 years ago • 4 comments

Is there a way to restrict the range you can scroll to. With the end and start set and with a maxZoom set you can still scroll indefinitely into the future and past.

geoffoddie avatar Aug 01 '16 19:08 geoffoddie

Have a go at providing values for minScale and maxScale. The defaults for these are 0 and Infinity, setting them will restrict the scroll range range.

twisty-n avatar Sep 28 '16 02:09 twisty-n

Thanks for this, however minScale and maxScale only seem to control zoom in and out but not the date range. e.g. I can scale down to days and scale up to years, however by moving left and right a user can potentially go back to the 10BC or forward to the year 4000.

geoffoddie avatar Sep 28 '16 16:09 geoffoddie

Here is a link for inspiration: http://bl.ocks.org/shawnbot/6518285

jpetitcolas avatar Jan 30 '18 17:01 jpetitcolas

If anyone is looking at this later on, you have to set .extent() and .translateExtent() passing in the constraint.

Busteren avatar Dec 31 '18 08:12 Busteren