Skip to content

Commit 8488d73

Browse files
committed
Set max bounds
1 parent 876cde9 commit 8488d73

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/howfar/map/core.cljs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,25 @@
3434
:iconSize [w h]
3535
:iconAnchor [(/ w 2) (/ h 2)]}))))
3636

37+
;; Default bounds covering NYC metro area isochrone extent (with padding)
38+
(def default-max-bounds
39+
{:south 39.5 :west -76
40+
:north 42 :east -71.75})
41+
3742
(defn create-map
3843
"Initialize Leaflet map"
3944
[element-id]
4045
(let [Map (.-Map L)
4146
TileLayer (.-TileLayer L)
47+
{:keys [south west north east]} default-max-bounds
4248
map-instance (new Map element-id #js {:center #js [40.7128 -74.0060]
4349
:zoom 12
50+
:minZoom 8
4451
:zoomControl true
45-
:clickTolerance 10})]
52+
:clickTolerance 10
53+
:maxBoundsViscosity 1.0
54+
:maxBounds #js [#js [south west]
55+
#js [north east]]})]
4656

4757
;; Add tile layer
4858
(.addTo (new TileLayer tile-layer-url

0 commit comments

Comments
 (0)