Commit Graph

536 Commits

Author SHA1 Message Date
Yohan Boniface
369290d90d Firefox has a Object.prototype.watch method 2013-12-09 15:59:20 +01:00
Vladimir Agafonkin
7f03570b8d move Layer-related Map code from Map.js to Layer.js 2013-12-06 15:10:29 +02:00
Vladimir Agafonkin
d55ffb07ec cleaner and more consistent zoom animation options 2013-12-06 15:10:29 +02:00
Vladimir Agafonkin
d70d03dbe1 more implicit falsy options to save bytes / memory; 2013-12-06 15:10:29 +02:00
Vladimir Agafonkin
edca4a6075 groups cleanup; fix getBounds when containing CircleMarkers 2013-12-06 15:10:28 +02:00
Vladimir Agafonkin
57bfbc45e6 simpler Map getMinZoom 2013-12-06 15:10:28 +02:00
Vladimir Agafonkin
36b8c7cf4d move zoom restricting logic to GridLayer 2013-12-06 15:10:28 +02:00
Vladimir Agafonkin
4011a6199f move add/removeLayer logic to Layer; ditch tilelayersload event 2013-12-06 15:10:28 +02:00
danzel
46a379adb7 A transitionEnd event only finished a zoom animation if it is for a transform. Fixes #2255 2013-12-06 14:54:48 +13:00
Vladimir Agafonkin
6b9731283d add and use DomUtil.remove 2013-12-05 14:35:39 +02:00
Vladimir Agafonkin
b151ceb63f remove LatLng constants, add move maxMargin to equals arguments 2013-12-03 19:09:36 +02:00
Vladimir Agafonkin
e43873298c update wrapping/bounding logic to allow negative coords 2013-12-02 19:16:01 +02:00
Vladimir Agafonkin
a03bfb753e add CRS & Map wrapLatLng, fix GridLayer bounding 2013-12-02 19:16:01 +02:00
Vladimir Agafonkin
627ca511d0 add Map getWorldPixelSize, remove hardcode for worldCopyJump 2013-12-02 19:16:00 +02:00
Ilya Zverev
0859c48fbf do not change internal properties in invalidateSize() when map is not loaded 2013-11-29 14:46:05 +04:00
Vladimir Agafonkin
88e60af971 fix shift-double-click on maps with vector layers #2189 2013-11-14 18:50:29 +02:00
Vladimir Agafonkin
fab5c3b676 adjust whitespace and add some comments 2013-11-14 18:04:39 +02:00
Vladimir Agafonkin
507e6c7aa5 proper rounding of max bounds offsets 2013-11-14 17:52:31 +02:00
Vladimir Agafonkin
80607c6044 reimplement max bounds with proper zooming 2013-11-14 17:45:47 +02:00
Vladimir Agafonkin
be42f7a3b6 Merge branch 'patch-1' of https://github.com/kapouer/Leaflet into maxbounds
* 'patch-1' of https://github.com/kapouer/Leaflet:
  test Map#setMaxBounds and Map#panInsideBounds
  panInsideBounds: fit or center, pass options, remove boundsMinZoom
2013-11-14 14:13:45 +02:00
Vladimir Agafonkin
07e8198ef6 add shift-double-click to zoom out, close #2185 2013-11-13 22:13:39 +02:00
Vladimir Agafonkin
3618f404f5 Merge branch 'invalidateSize' 2013-11-13 21:50:02 +02:00
John Firebaugh
33263e537d Add debounceMoveend option to invalidateSize 2013-11-13 10:53:34 -08:00
John Firebaugh
248c5e7c8f Don't delay moveend event on invalidateSize
This causes unnecessary nondeterminism in the sequence of
events emitted. Instead, the caller should be responsible for
throttling, as e.g. Map#_onResize does.
2013-11-11 14:02:00 -08:00
Vladimir Agafonkin
45181ce40b move old IE styles to leaflet.css, ditch leaflet.ie.css, close #2159 2013-11-08 16:44:14 +02:00
Vladimir Agafonkin
ddbb01c3da add distance to dragend event data, close #2158, ref #872 2013-11-06 21:17:35 +02:00
Vladimir Agafonkin
1aba51be01 Merge pull request #2072 from trevorpowell/master
Don't bounce near zoom limits on touch zoom
2013-10-24 12:12:57 -07:00
Trevor Powell
0574301113 Fixing long line 2013-10-24 13:34:17 -05:00
Trevor Powell
3b79dd816b Adding bounceAtZoomLimits option 2013-10-24 13:26:52 -05:00
Vladimir Agafonkin
a8baeec367 add timestamp to geolocation data, #584 2013-10-18 18:47:04 +03:00
Vladimir Agafonkin
c3734e5a91 add maxZoom to Map fitBounds options, close #2101 2013-10-17 00:17:31 +03:00
Jérémy Lal
2974cacff4 panInsideBounds: fit or center, pass options, remove boundsMinZoom
Deltas are calculated on x, y pixel coordinates separately.
Options are propagated from setMaxBounds to panBy.
No panBy loops. Fixes #1908.
2013-10-14 14:40:45 +02:00
Trevor Powell
7a907ba2cf Fixing line too long error 2013-10-06 01:39:01 -05:00
Trevor Powell
7541d64a71 Do not scale above minzoom and maxzoom in touch zoom action 2013-10-06 01:20:45 -05:00
danzel
bf3b660bef Redo MsTouch to be pointer events with msPointer fallback for IE10. fixes #2037 2013-10-04 15:06:53 +13:00
Vladimir Agafonkin
2250cee6ec allow setZoom before setView, make setView zoom optional, close #2056, close #1449 2013-09-30 15:00:46 +03:00
Vladimir Agafonkin
6c77fe64c2 fix IE6-8 throwing error on map.remove(), close #2015 2013-09-13 18:14:05 +03:00
Vladimir Agafonkin
3d5dbe7dfc fix accidentally commented out fix, #1980 2013-08-29 00:51:00 +03:00
Vladimir Agafonkin
62b23b42e0 fix resize tracking on multiple maps, close #1980 2013-08-28 17:56:43 +03:00
Dag Jomar Mersland
5180cce838 check for undefined el.tagName prevents iPad error 2013-08-21 13:30:10 +02:00
Dag Jomar Mersland
d78fb49943 Fix for iPad, where el.tagName was undefined when clicking on labels. 2013-08-19 10:14:36 +02:00
Vladimir Agafonkin
1f6533d0f5 Merge pull request #1982 from fastrde/FixworldCopyJump
Fix worldCopyJump set Center and Zoom first
2013-08-18 01:21:31 -07:00
fastrde
b4ed2bf282 map.once doesn't get called when the map is already initailized and drag.enabled is called. 2013-08-17 12:13:47 +02:00
fastrde
3370942b36 call _onViewReset() not until map is loaded (center and zoom are set) 2013-08-17 02:08:24 +02:00
fastrde
5eacbbf105 Added Keycode 171 to support Firefox 22 2013-08-17 00:38:51 +02:00
Vladimir Agafonkin
4609d482f2 some tweaks to #1951 2013-08-09 14:00:44 +03:00
fastrde
c1e64c2479 Fix for zoomBox fires map click Event (Issue #1884) 2013-08-08 15:15:39 +02:00
John Firebaugh
65a311a822 Return this even when short-circuiting 2013-08-06 10:27:27 -07:00
Vladimir Agafonkin
e18b7eded6 Merge pull request #1931 from russelldavis/fix-invalidate-size
Fix rounding issues in Map::invalidateSize
2013-08-06 02:43:40 -07:00
Vladimir Agafonkin
8611e22005 Merge pull request #1939 from jfirebaugh/zoom
Support center-oriented scroll/double-click zoom
2013-08-06 01:55:08 -07:00
John Firebaugh
a0c6363bb6 Invalidate _initialCenter along with size (fixes #1919) 2013-08-05 14:09:09 -07:00
John Firebaugh
4fdf76ee90 Support center-oriented scroll/double-click zoom 2013-08-05 12:29:55 -07:00
Russell Davis
f568768142 Fix rounding issues in Map::invalidateSize 2013-08-01 23:14:11 -07:00
Vladimir Agafonkin
8d925b6acb fix map scrolling right on click with horizontal scroll on page, close #1901 2013-07-25 12:49:16 +03:00
Vladimir Agafonkin
42a78fd867 fix infinite loop in getBounds and setMaxBounds, close #1895, close #1866 2013-07-25 12:42:13 +03:00
Vladimir Agafonkin
75c133082c fix Map min/maxZoom not overriding TileLayer-derived min/max, close #1848 2013-07-12 15:05:59 +03:00
Vladimir Agafonkin
a4c6c03550 break line to fix jshint 2013-07-12 12:46:10 +03:00
Vladimir Agafonkin
5c1a34979e fix fakeStop in IE<9, close #1850 hopefully 2013-07-12 12:41:08 +03:00
Vladimir Agafonkin
5829963014 do not animate zoom if nothing to animate yet, close #1484, close #1845 2013-07-11 15:59:13 +03:00
Vladimir Agafonkin
183c8a2cb7 merge #1834 (passing options to setMaxBounds) 2013-07-11 13:03:41 +03:00
John Firebaugh
4839c44509 Fire layerremove after removing the layer
This is consistent with 0.5.x and seems more useful. Updating
the state of a layer switcher using map.hasLayer in response
to layeradd and layerremove events is my use case.
2013-07-08 16:53:04 -07:00
David Beitey
c663392697 Allow options to be passed to Map.setMaxBounds such that they can be used when setting the view. 2013-07-05 14:12:09 +10:00
danzel
fef108cc8e Fix worldCopyJump if you start zoomed all the way out. Fixes #1831 2013-07-05 14:35:48 +12:00
danzel
71e851fa40 Remove trailing comma, fixes IE7. Refs #1755 2013-07-01 15:56:04 +12:00
John Firebaugh
725124931f preventDefault on MozMousePixelScroll
This prevents scrolling without changing the zoom delta
calculations.

Fixes #1794
2013-06-27 10:28:13 -04:00
John Firebaugh
bc40266bc9 Revert "Use "wheel" event where supported (#1788)"
This reverts commit a784c560e5.
2013-06-27 10:27:42 -04:00
John Firebaugh
7355070958 Merge pull request #1789 from Leaflet/wheel
Use "wheel" event where supported (#1788)
2013-06-25 10:40:14 -07:00
John Firebaugh
a784c560e5 Use "wheel" event where supported (#1788) 2013-06-25 13:31:51 -04:00
Vladimir Agafonkin
55a36e2fe8 fix regression of not being able to addLayer in initHooks 2013-06-25 11:25:10 -04:00
John Firebaugh
cb4b4ff343 Remove preventDefault from BoxZoom too 2013-06-25 10:12:02 -04:00
Vladimir Agafonkin
89d0730254 fix Android firing click twice on buttons, close #1785, related #1694 2013-06-25 09:45:35 -04:00
Vladimir Agafonkin
28ba41eced disable tap hacks on IE, ref #1694 2013-06-24 23:11:51 -04:00
Vladimir Agafonkin
e72e2476f8 remove leftover code 2013-06-24 22:38:38 -04:00
Vladimir Agafonkin
f9ea4758f8 move all tap hacks code into a separate handler, close #1781 2013-06-24 18:17:25 -04:00
Vladimir Agafonkin
a12bd9474f call init hooks before adding layers (fixes zoom anim regression) 2013-06-24 17:37:31 -04:00
Vladimir Agafonkin
5a7420dd1a Propagate popup clicks outside of map container, close #301 2013-06-24 15:19:17 -04:00
Tom MacWright
130d6d0fac Ignore pan keyboard event if the map is animating. Fixes #1710 2013-06-24 13:50:24 -04:00
Vladimir Agafonkin
6c061b2995 fix zoom not working with L_DISABLE_3D regression, close #1756 2013-06-24 11:32:51 -04:00
Vladimir Agafonkin
57a3112b85 fix geolocation data regression in FF/IE, close #1755 2013-06-24 09:50:47 -04:00
Vladimir Agafonkin
9bd725d669 fix zoom anim regression with a hack for now, close #1705 2013-06-24 09:39:49 -04:00
Vladimir Agafonkin
ca4918977b change map.invalidateSize signature to accept options, close #1767, #1766 2013-06-24 09:26:23 -04:00
jacobtoye
f9920c87f0 Moving brace to correct position. 2013-06-21 09:38:44 +12:00
jacobtoye
b262fdd26b Add parameter to invalidateSize for changing the center. 2013-06-20 16:59:14 +12:00
Vladimir Agafonkin
66d6403ddd update layers icon, add retina version, cleaner popup styles, close #1739 2013-06-11 15:44:21 +03:00
Josh Caldwell
df5e43a062 Unbind moveend event when maxBounds removed 2013-06-10 18:32:20 -04:00
Vladimir Agafonkin
aaad3cbe2f fix hinting error, update build 2013-06-03 12:39:28 +03:00
John Firebaugh
4802561e0e Don't fire layerremove if layeradd was never fired 2013-06-01 22:16:53 -07:00
John Firebaugh
51fccc80fe Don't call Layer#onAdd on a layer that has been removed 2013-06-01 22:11:42 -07:00
John Firebaugh
055b3393da Don't call Layer#onRemove if Layer#onAdd was never called 2013-06-01 21:50:18 -07:00
John Firebaugh
01bede20d1 Fix indentation 2013-06-01 21:49:45 -07:00
Vladimir Agafonkin
6f752d171b simplify zoom anim a bit 2013-05-10 17:28:27 +03:00
Vladimir Agafonkin
f2d237b01c Merge pull request #1617 from Leaflet/setview-anim
Control animation in setView/panTo/setZoom/fitBounds/etc.
2013-05-03 02:12:21 -07:00
Vladimir Agafonkin
df72027401 accept true as a third setView argument for compatibility 2013-04-30 17:09:55 +03:00
Vladimir Agafonkin
5ab4d4a4be minor cleanup 2013-04-30 17:08:10 +03:00
Vladimir Agafonkin
260a869da6 accept global animate option in setView 2013-04-30 17:06:16 +03:00
Vladimir Agafonkin
8d759e6c5e clean up handlers and panes on map remove, close #1621 2013-04-30 16:51:51 +03:00
Vladimir Agafonkin
05bbb68cd8 rename zoom/panOptions to zoom/pan in setView options 2013-04-24 18:13:36 +03:00
Vladimir Agafonkin
55d95d1362 options in view change methods, ability to turn on/off animation, closes #1616 2013-04-24 16:24:56 +03:00
Vladimir Agafonkin
b61b7b4757 don't scroll to top of the map on focus, close #1228, close #1540 2013-04-23 11:57:42 +03:00
Vladimir Agafonkin
94098134a6 fix regression in Map hasLayer 2013-04-22 19:20:19 +03:00
Vladimir Agafonkin
113e55c62a better property name 2013-04-22 18:24:55 +03:00
Vladimir Agafonkin
6fa08d31c6 prevent setView after geolocation if called stopLocate, close #747 2013-04-22 18:24:11 +03:00
Vladimir Agafonkin
557ebaad3c cleanup, utilize factories more 2013-04-22 17:49:03 +03:00
Vladimir Agafonkin
29239891d8 minor cleanup 2013-04-22 17:20:34 +03:00
Vladimir Agafonkin
eafa54635b simplify fitBounds-related code, fix typo 2013-04-22 17:06:42 +03:00
Vladimir Agafonkin
de0cd66f88 Add padding options for map.fitBounds/getBoundsZoom, close #859
Also make fitBounds accept ILayer, and fix bounds for fitWorld, close
#960
2013-04-22 15:21:30 +03:00
Vladimir Agafonkin
9ac57e04f4 move Map control methods to Control.js 2013-04-20 17:04:17 +03:00
Vladimir Agafonkin
7cb7993571 simplify popup methods, merge #738 2013-04-20 16:58:42 +03:00
Vladimir Agafonkin
bd0bc4f2e5 fire load before viewreset/moveend 2013-04-20 12:07:00 +03:00
Vladimir Agafonkin
340dacde81 remove hasOwnProperty checks, close #1606 2013-04-20 11:32:23 +03:00
Vladimir Agafonkin
e01fe91a33 fix fitBounds for large bounds, close #1069, thanks to @MaZderMind 2013-04-19 15:43:39 +03:00
Vladimir Agafonkin
d856e8814e don't animate if zoom difference is too large, close #1377
also adds zoomAnimationThreshold map option (defaults to 4)
2013-04-19 12:47:55 +03:00
Vladimir Agafonkin
db6d689ad8 fix lots of maxBounds issues, close #1491, close #1475, close #1194, close #900, #1333 2013-04-18 17:05:47 +03:00
Vladimir Agafonkin
0b1bc7a94c add resize event, close #1564 2013-04-18 15:26:45 +03:00
danzel
989d9b9763 Fix up brace position 2013-04-16 08:25:22 +12:00
danzel
b36d973d14 Better fixes for touchzoom while zooming. If we got a touchmove and touchend in series before the animation frame for the touchmove fired then we'd get into a broken state. 2013-04-15 11:53:31 +12:00
danzel
633ae89b8e Fix touch zooming while zoom animation is playing. Fixes #1591 #1571 2013-04-15 09:57:47 +12:00
Vladimir Agafonkin
c4dc595490 more strict jshinting, enforce single quotes and camelCase for consistency 2013-04-11 12:45:52 +03:00
Vladimir Agafonkin
c6cdd66e2d add map setZoomAround, merge #1582, close #1157 2013-04-11 12:07:07 +03:00
Ansis Brammanis
6c53aa6867 dblclicking now zooms around mouse, not centre 2013-04-10 17:09:31 -04:00
Vladimir Agafonkin
386bf68386 Merge pull request #1574 from tmcw/map-initialization-exception
Throw an exception if a map div is not found and test for initialization exceptions
2013-04-08 13:46:53 -07:00
Christian Schwarz
48bec16f49 Fixed zoom out on Windows 8 with Firefox
Firefox receives wheel delta of 0.33 on zoom in and -0.33 on zoom out, which turns into Math.ceil(0.33) == 1 and Math.round(-0.33) == 0. After this fix it returns correctly -1 for zooming out.
Worked fine before and after this fix in Chrome and Internet Explorer.
2013-04-08 23:33:53 +03:00
Tom MacWright
22810aacf7 Throw an exception if a map div is not found
and test for initialization exceptions
2013-04-08 12:28:27 -04:00
Vladimir Agafonkin
08a8c39088 fix moveend not always firing on drag 2013-03-28 11:10:44 +02:00
danzel
9ae07469c5 Fix zooming on browsers without zoom animation support. Refs #1486 2013-03-05 09:29:41 +13:00
John Firebaugh
511fbb9f44 Add Map#eachLayer (fixes #1457) 2013-02-26 11:39:00 -08:00
Vladimir Agafonkin
a2890d6c4b cleanup and prettify animation code, more comments 2013-02-22 17:29:52 +02:00
John Firebaugh
46dddc895c Fire an unload event on removal
Plugins that need to bind events to `window` or `document`
can attach a listener for this event and unbind their event
handlers.

However, for symmetry, unload is fired only if load has been
fired.
2013-02-21 17:31:09 -08:00
Vladimir Agafonkin
5558987272 fix geolocation accuracy bounds, add more event data, close #984, related #584, #987, #1028 2013-02-21 14:41:26 +02:00
Yohan Boniface
7fd4ca20fe Allow for canceling a boxzoom being drawn pressing Escape key 2013-02-20 20:47:23 +01:00
Vladimir Agafonkin
5c18361aa2 fix typo, fix animated setView not converting latlng input 2013-02-20 20:54:12 +02:00
Vladimir Agafonkin
cf00a0113d fix rounding error when changing zoom, close #426 2013-02-20 20:11:47 +02:00
Vladimir Agafonkin
06190b1ec8 Merge pull request #1434 from jfirebaugh/remove
Add Map#remove
2013-02-20 09:41:44 -08:00
Vladimir Agafonkin
40a824fc97 refactor TileLayer animation, fix #1140, #1437, #52, #1442
Refactored TileLayer animation so that it happens for each tile layer
independently instead of animating the parent of all tile layers. Moved
TileLayer animation code into a separate file (TileLayer.Anim.js).
Fixes loads of bugs and makes the code easier to understand.
2013-02-20 18:40:00 +02:00
John Firebaugh
6ef25866eb Add Map#remove
This is a minimal implementation; it only unbinds events
and deletes the _leaflet flag from the container.

Refs #1101.
2013-02-19 17:36:03 -08:00
Vladimir Agafonkin
d98b4ea035 throw meaningful exception on getCenter before setView, close #1395 2013-02-19 16:54:29 +02:00
Vladimir Agafonkin
a948379db8 Merge pull request #1376 from moonlite/zoomlevelschange-event
Zoomlevelschange event
2013-02-14 03:35:57 -08:00
Mattias Bengtsson
cbee6851c8 Don't expose getZoomLevels. 2013-02-14 12:00:08 +01:00
Mattias Bengtsson
efe0c6f6ea Fire zoomlevelschange event when zoomlevels are updated.
This is triggered when you remove a layer from a map with greater
zoom level coverage than the remainding layers or when you add a tilelayer
with greater zoomlevel coverage than the previous set of layers had.
2013-02-14 03:04:10 +01:00
oslek
c3ccf01a29 prevent extra movestart on inertia drag 2013-02-13 13:35:40 -08:00
oslek
f7301fa267 fire dragend before moveend for consistency 2013-02-13 13:25:02 -08:00
oslek
2c11fdfa6d prevent false move events in invalidateSize 2013-02-13 12:38:33 -08:00
Roemer Vlasveld
109fd06ae6 hasLayer not checking for null
Return false when checking for a null object in L.Map.hasLayer, in
response to issue #1282.
2013-01-21 23:22:01 +01:00
Vladimir Agafonkin
eed2c8a12b fix FF minus key, close #869, update changelog and build 2013-01-17 11:51:52 +02:00
oslek
7dd7e4f699 Robust array type check for cross-frame support
In a multi-frame DOM environment, if setView is called with an array for
the first parameter, a subsequent call to getBounds raises "Invalid
LatLng object" exception. This is the case if the array passed to
setView was created outside the iFrame that contains the map. It causes
the array test using "instanceof" in L.latLng to fail, and
_initialTopLeftPoint to not being properly initialized.

Thank you to Juriy Zaytsev for the full explaination:
http://perfectionkills.com/instanceof-considered-harmful-or-how-to-write-a-robust-isarray/
John Resig and Dean Edwards post comments and concur.
2013-01-14 14:04:50 -08:00
Vladimir Agafonkin
b9727d9190 made up my mind about comment format, add some more comments 2012-12-20 12:37:40 +02:00
Vladimir Agafonkin
b0e5c817a9 more comments and cleanup 2012-12-19 18:47:28 +02:00
Vladimir Agafonkin
51aa31fa8a cleanup keyboard maxbounds 2012-12-19 16:41:13 +02:00
snkashis
38c4d9dd56 Check bounds when navigating with keyboard. #989 2012-12-18 14:17:18 -05:00
Vladimir Agafonkin
c6caf93c00 refactor build scripts, cleanup 2012-12-17 19:15:19 +02:00