113 KiB
Leaflet Changelog
(all changes without author notice are by @mourner)
0.8-dev (master)
An in-progress version being developed on the master
branch. Includes stable
branch fixes.
This version contains a lot of beneficial but potentially breaking changes (especially if you're a plugin author), so please read through the changes carefully before upgrading.
Vectors refactoring
Leaflet vector layers rendering got a major rewrite, making it possible to switch between rendering backends (Canvas, SVG) dynamically (and even use both for different layers at the same time), have more than one physical pane for vector layers, significantly improving Canvas performance and adding retina support, getting rid of ugly hacks and generally making the code much cleaner. PR #2290.
- Added
Renderer
layer (inherited by SVG/Canvas implementations) that handles renderer bounds and zoom animation. - Added
SVG
&Canvas
classes that now contain all renderer-specific code for vector layers and can be added as layers to the map. - All vector layer classes (
Path
,Polyline
, etc.) now don't contain any renderer-specific code and instead can be passed a renderer layer to use asrenderer
in options; - Removed
MultiPolyline
andMultiPolygon
classes since multiple rings are now handled byPolyline
andPolygon
classes respectively. Layers with multiple rings now perform much better (since each is now physically a single path object instead of being aFeatureGroup
of layers). - Dramatically improved performance of interactive Canvas layers. Mouse events work much faster (due to improved hit detection algorithms), and layers get updated many times faster (with partial redraws instead of redrawing the whole Canvas).
- Added retina support for Canvas layers.
- Improved default vector layer styles.
- Added
Polyline
andPolygon
getCenter
for getting centroids. - Respectively, improved
Polyline
andPolygon
popup positioning when callingopenPopup
. - Improved
Polyline
/Polygon
getBounds
to be cached (so it works much faster). - Changed
Circle
to inherit fromCircleMarker
and not the other way. - Fixed
GeoJSON
resetStyle
to work properly in casestyle
option wasn't set. - Fixed a bug where map fired
moveend
when updating Canvas layers.
Layers refactoring
All Leaflet layers (including markers, popups, tile and vector layers) have been refactored to have a common parent, Layer
class, that shares the basic logic of adding and removing. The leads to the following changes (documented in PR #2266):
- Added
Layer
class which all layers added to a map should inherit from. - Added
add
andremove
events to all layers. - Added
pane
option to all layers that can be changed (e.g. you can setpane: 'overlayPane'
to a tile layer). - Added
remove
method to layers and controls (marker.remove()
is now equivalent tomap.removeLayer(marker)
). - Added
shadowPane
option to markers as well. - Added
getEvents
method to all layers that returns an{event: listener, ...}
hash; layers now manage its listeners automatically without having to do this inonAdd
/onRemove
. - Improved performance of adding/removing layers with layers control present (instead of listening to any layer add/remove, the control only listens to layers added in configuration).
- Fixed
FeatureGroup
getBounds
to work correctly when containing circle markers. - Removed
Map
tilelayersload
event. - Removed
Popup
open
andclose
events in favor ofadd
andremove
for consistency. - Moved all layer-related logic in
Map.js
toLayer.js
.
TileLayer & Projections refactoring
TileLayer code and everything projections-related has undergone a major refactoring, documented in PR #2247. It includes the following changes (in addition to much cleaner and simpler code):
TileLayer-related changes
These changes make implementing custom grid-like layers for Leaflet much easier.
- Moved most of the
TileLayer
logic into the newGridLayer
class (whichTileLayer
now inherits, extending it with logic specific to tile servers). - Removed
TileLayer.Canvas
in favor of the much more flexible and powerfulGridLayer
. - Improved tile wrapping and bounding logic in
TileLayer
to work transparently and completely depent on the CRS used; removed the need forTileLayer
hacks when using custom projections. - Removed
url
property intileload
andtileloadstart
events (get it throughtile.src
).
Projections-related changes
These changes were targeted at removing any hardcoded projection-specific logic accross Leaflet classes, making it transparent and driven by the chosen CRS. They make using Leaflet with custom projections (including flat maps) much easier, and remove the need for ugly hacks in the Proj4Leaflet plugin.
- Added
CRS.Earth
which serves as a base for all Earth-based CRS (EPSG3857
etc.). #2345 - Added
Projection
bounds
property that defines bounds for different projections (Mercator
, etc.) in projected coordinates (by @perliedman). - Added
CRS
wrapLat
andwrapLng
properties which define whether the world wraps on a given axis and in what range. Set as[-180, 180]
forEPSG:3857
,EPSG:4326
,EPSG:3395
by default. - Removed
LatLng
wrap
method; addedCRS
andMap
wrapLatLng
instead (so that wrapping depends on the chosen CRS). - Added
CRS
infinite
property that disables boundaries (the world can go on infinitely in any direction), default forCRS.Simple
. - Added
CRS
getProjectedBounds
andMap
getPixelWorldBounds
methods that returns world bounds in projected coordinates depending on zoom (derived fromProjection
bounds
) (by @perliedman). - Added
CRS
unproject
method that converts coordinates in CRS-dependent units intoLatLng
coordinates (by @sowelie). - Added
Map
distance(latlng1, latlng2)
method that takes CRS into account and works with flat projections. #2345 #1442 - Improved
Circle
to be approximated with an ellipse in Earth-based projections. #2345 - Fixed
EPSG:4326
to have correct tile pyramid (2x1 tiles at root). - Fixed
Projection.SphericalMercator
to project to meter units (by @calvinmetcalf). - Fixed
Map
worldCopyJump
option to work for other projections. - Fixed
Circle
to work with flat projections. #2345 #1465 - Fixed scale control precision in non-EPSG:3857 projections. #2345
Animations refactoring
- Improved performance in iOS Safari; pinch-zooming should be smoother now. #2377
- Fixed gaps between tiles during animations in desktop Safari. #2377
- Improved panning inertia behavior so that there are no tearing during animation when panning around quickly. #2360
Other performance and usability improvements
- Significantly improved
LatLng
creation performance (8x). - Improved performance of layer objects construction.
- Significantly improved
FeatureGroup
(and correspondinglyGeoJSON
) layer adding and events performance (about 10x) by implementing a much better event propagation mechanism. #2311 - Improved keyboard support to ignore keystrokes with modifier keys (Ctrl, Alt, Meta) to not interfere with OS shortcuts.
- Added popup fade out animation.
Other breaking API changes
- Changed
DomUtil
off
to requirecontext
attribute if you remove a listener that was previously added with a particular context. - Removed
DomUtil.getViewportOffset
method as it is no longer necessary. - Removed
LatLng
RAD_TO_DEG
,DEG_TO_RAD
andMAX_MARGIN
constants. - Removed
DomUtil
getTranslateString
andgetScaleString
methods.
Other API improvements
- Added
Evented
class that now many Leaflet classes inherit from (instead of mixing in events methods in each class), while keeping the oldincludes: L.Mixin.Events
syntax available. #2310 - Improved
Class
options
to be prototypically inherited instead of copied over in children classes, which leads to more efficient memory use, faster object construction times and ability to change parent options that get propagated to all children automatically (by @jfirebaugh). #2300 #2294 - Added
{r}
variable toTileLayer
url
for adding"@2x"
prefix on Retina-enabled devices (by @urbaniak). #2296 - Added
Point
ceil
method (by @perliedman). - Added
Util.wrapNum
method for wrapping a number to lie in a certain range. - Improved
L.bind
to use nativeFunction
bind
on modern browsers and prepend real arguments to bound ones. - Added
LatLng
equals
second argumentmaxMargin
. - Added
DomUtil
setClass
andgetClass
methods. - Improve
Marker
move
event to includeoldLatlng
(by @danzel). #2412
Bugfixes
- Fixed
DomUtil
on
to make it possible to add the same listener to the same element for multiple contexts. - Fixed a bug that thowed an error when attempting to reinitialize the map on unload (by @gamb). #2410
- Fixed excessively blurry non-retina tiles on retina iOS devices.
- Fixed a bug with popup close button in IE7/8. #2351
- Fixed
ImageOverlay
mercator distortion on lower zoom levels. - Fixed a bug where layers didn't fire
popupopen
andpopupclose
events when manually creating a popup object and passing it tobindPopup
. #2354
Misc improvements
- Improved the build system (
jake build
) to report gzipped library size. - Added Leaflet logo in vector format as
src/images/logo.svg
. - Added reference to Leaflet CSS in
package.json
(by @bclinkinbeard). #2432
0.7.2 (January 17, 2014)
- Fixed a bug that appeared with Chrome 32 update that made all mouse events shifted on scrolled pages. #2352
- Fixed a bug that could break tile loading when using non-standard tile sizes. #2288
- Fixed a bug where
maxNativeZoom
option didn't work with TMS tile layers (by @perliedman). #2321 #2314
0.7.1 (December 6, 2013)
- Fixed a bug where pinch-zooming quickly could occasionally leave the map at a fractional zoom thus breaking tile loading (by @danzel). #2269 #2255 #1934
- Fixed tile flickering issues on some old Android 2/3 devices by disabling buggy hardware accelerated CSS there (by @danzel). #2216 #2198
- Fixed a regression that sometimes led to an error when you started pinch-zoom as the first action on the map (by @danzel). #2259 #2256
- Reverted
L.Util.template
optimizations to allow Leaflet to be used in eval-banning environments like browser extensions (performance gain was insignificant anyway) (by @calvinmetcalf). #2217 #2209 #1968 - Fixed a regression where
Map
invalidateSize
could lead to unexpected results when called before map initialization (by @Zverik). #2250 #2249 - Fixed a regression where
FeatureGroup
containing other group overwrote originale.layer
value in mouse events (by @gumballhead). #2253 #2252 - Fixed a regression where
CircleMarker
setLatLngs
didn't returnthis
(by @radicalbiscuit). #2206
0.7 (November 18, 2013)
Improvements
Usability improvements
- Added support for IE11 touch devices (by @danzel, @DanielX2 and @fnicollet). #2039 #2066 #2037 #2102
- Added shift-double-click to zoom out shortcut. #2185
- Significantly improved controls design on mobile devices. #1868 #2012
- Fixed and improved IE7-8 control and popup styles.
- Made subtle improvements to control styles on desktop browsers.
- Improved keyboard nav support so that map doesn't loose focus when you click on a control (by @jacobtoye). #2150 #2148
- Improved
maxBounds
behavior: now it doesn't force higher minimal zoom, and anchors to max bounds edges properly when zooming (by @kapouer and @mourner). #2187 #1946 #2081 #2168 #1908
Map API improvements
- Made
Map
setView
zoom
argument optional. #2056 - Added
maxZoom
option toMap
fitBounds
. #2101 - Added
Map
bounceAtZoomLimits
option that makes the map bounce when you pinch-zoom past limits (it worked like this before, but now you can disable this) (by @trevorpowell). #1864 #2072 - Added
distance
property toMap
andMarker
dragend
events. #2158 #872 - Added optional support for center-oriented scroll and double-click zoom (by @jfirebaugh). #1939
- Added
timestamp
toMap
locationfound
event. #584 - Improved
Map
invalidateSize
to callmoveend
immediately unless givendebounceMoveend: true
option (by @jfirebaugh). #2181
TileLayer API improvements
- Added
TileLayer
maxNativeZoom
option that allows displaying tile layers on zoom levels above their maximum by upscaling tiles. #1802 #1798 - Added
TileLayer
tileloadstart
event (by @tmcw). #2142 #2140 - Improved
TileLayer
world size (used for wrapping and limiting tiles) to be derived from CRS instead of hardcoded, making it easier to use with custom projections (by @perliedman). #2160
Marker API improvements
- Added CSS classes to draggable markers for easier customization (by @snkashis). #1902 #1916
- Added
Marker
add
event (by @tohaocean). #1942 - Added
Marker
getPopup
method (by @scottharvey). #618 #1197 - Added
Marker
alt
option for addingalt
text to markers (by @jimmytidey). #2112
Vector layers API improvements
- Added
Path
className
option for adding custom class names to vector layers. - Added
Path
lineCap
andlineJoin
options (by @palewire). #1843 #1863 #1881 - Added ability to pass vector options to
GeoJSON
(by @kapouer). #2075 - Improved
Polygon
setLatLngs
to also accept holes (by @aparshin). #2095 #1518 - Added
GeoJSON
3D format support and optionalaltitude
argument toLatLng
constructor (by @Starefossen). #1822 - Added
MultiPolygon
andMultiPolyline
openPopup
method. #2046
Popup API improvements
- Added
Popup
update
method. #1959 - Added
Popup
autoPanPaddingTopLeft
andautoPanPaddingBottomRight
options (by @albburtsev). #1972 #1588 - Added
Popup
getContent
method. #2100 - Added
Popup
getLatLng
method (by @AndreyGeonya). #2097
Misc API improvements
- Added
ImageOverlay
setUrl
andgetAttribution
methods andattribution
option (by @stsydow). #1957 #1958 - Added localization support for the zoom control (by @Danielku15). #1953 #1643 #1953
- Significantly improved
L.Util.template
performance (affectsL.TileLayer
) by introducing cached template compilation (by @calvinmetcalf). #1969 #1968 #1554 - Added
CRS
getSize
for getting the world size in pixels (by @perliedman). #2160 - Added
leaflet-drag-target
CSS class to an element under cursor when dragging for more flexible customization. #2164 #1902 - Improved
L.DomUtil
addClass
,removeClass
,hasClass
methods performance and fixed it to work with SVG elements. #2164
Dev workflow improvements
- Added an official FAQ.
- Cleaned up and moved old IE styles to
leaflet.css
and removedleaflet.ie.css
, so no need for IE conditional comment when including Leaflet now. #2159 - Added
leaflet-oldie
CSS class to map container in IE7-8 for easier styling. #2159 - Officially dropped support for IE6. Nobody cares anyway, and Leaflet should still be accessible on it. #2159
- Improved the build system to check JS errors in spec files. #2151
- Fixed
jake
command to run tests before building the source. #2151 - Switched the main file in
package.json
to unminified version for NPM/Browserify (by @icetan). #2109
Bugfixes
0.6 regression fixes
- Fixed a memory leak in iOS7 that could crash Safari when handling lots of objects (e.g. 1000 markers) (by @danzel). #2149 #2122
- Fixed a bug that caused lag at the beginning of panning in Chrome (by @jfirebaugh). #2163
- Fixed a regression that made the layers control unscrollable in Firefox. #2029
- Fixed a regression that broke
worldCopyJump: true
option (by @fastrde). #1904 #1831 #1982 - Fixed a regression where a first map click after popup close button click was ignored (by @fastrde). #1537 #1963 #1925
- Fixed a regression where
L.DomUtil.getMousePosition
would throw an error if container argument not provided (by @scooterw). #1826 #1928 #1926 - Fixed a regression with vector layers positioning when zooming on IE10+ touch devices (by @danzel). #2002 #2000
- Fixed a regression with
maxBounds
behaving weirdly on panning inertia out of bounds. #2168
General bugfixes
- Fixed a bug where the map could freeze if centered and immediately recentered on initialization. #2071
- Fixed a bug where all maps except the first one on a page didn't track window resize. #1980
- Fixed a bug where tiles in
EPSG:3395
projection were shifted (by @aparshin). #2020 - Fixed a bug where scale control displayed wrong scale when on pages with
box-sizing: border-box
. - Fixed a bug where zoom control button didn't appear as disabled if map was initialized at the zoom limit. #2083
- Fixed a bug where box zoom also triggered a map click event (by @fastrde). #1951 #1884
- Fixed a bug where shift-clicking on a map immediately after a drag didn't trigger a click event (by @fastrde). #1952 #1950
- Fixed a bug where content was updated twice when opening a popup. #2137
- Fixed a bug that could sometimes cause infinite panning loop when using
maxBounds
(by @kapouer and @mourner). #2187 #1946 #2081 #2168 #1908
Browser bugfixes
- Fixed a bug where keyboard
+
no longer zoomed the map on FF 22+ (by @fastrde). #1943 #1981 - Fixed a bug where calling
Map
remove
throwed an error in IE6-8. #2015 - Fixed a bug where
isArray
didn't work in rare cases in IE9. #2077 - Fixed a bug where FF sometimes produced console warnings when animating markers. #2090
- Fixed a bug where mouse wasn't handled correctly on RTL pages in some cases (by @danzel). #1986 #2136
Mobile bugfixes
- Fixed a bug where tiles could disappear after zooming on Chrome 30+ for Android (by @danzel). #2152 #2078
- Fixed a bug on IE10+ touch where pinch-zoom also caused click (by @danzel). #2117 #2094
- Fixed a bug on IE10+ touch where controls didn't loose the pressed state after tapping (by @danzel). #2111 #2103
- Fixed a bug where clicking on layers control labels on iOS throwed an error (by @olemarkus and @dagjomar). #1984 #1989
Map API bugfixes
- Fixed a bug where
Map
getCenter
returned old result after map container size changed (by @jfirebaugh). #1940 #1919 - Fixed
Map
invalidateSize
rounding issues when changing map size by an odd pixel amount (by @russelldavis). #1931 - Fixed a bug where
Map
removeLayer
didn't returnthis
in a corner case (by @jfirebaugh). - Fixed a bug where calling
Map
setZoom
beforesetView
would throw an error. #1449
Layers API bugfixes
- Fixed a bug where
Popup
setLatLng
unnecessarily reset content and updated layout; works much faster now. #2167 - Fixed a bug where
toGeoJSON
of layers originated from GeoJSON GeometryCollection and MultiPoint didn't work properly (wasn't round-tripped). #1956 - Fixed
GeoJSON
dependencies in build configuration that could lead to a broken custom build in some situations (by @alubchuk). #1909 - Fixed a bug where
CircleMarker
popup placement wasn't updated after callingsetLatLng
(by @snkashis). #1921 #1927 - Fixed a bug where popup anchor wasn't updated on
Marker
setIcon
(by @snkashis). #1874 #1891 - Fixed a bug with GeoJSON not throwing a descriptive error if a polygon has zero length inner ring (by @snkashis). #1917 #1918
- Fixed a bug where
FeatureGroup
would break when using non-evented children layers (by @tmcw). #2032 #1962 - Fixed a bug where
CircleMarker
getRadius
would always returnnull
. #2016 #2017 - Fixed a bug where
TileLayer.WMS
didn't work with WMS 1.3 & EPSG4326 projection (by @Bobboya). #1897 - Fixed a bug where
FeatureGroup
eventse.layer
was sometimes empty in old IE. #1938
Misc API bugfixes
- Fixed a bug where
L.latLngBounds
didn't accept simple objectLatLng
form (by @Gnurfos). #2025 #1915 - Fixed a bug where
L.Util.tempalate
wouldn't work with double quotes in the string (by @jieter). #1968 #2121 #2120 - Fixed a bug where attribution control that was added to a map after attributed layers didn't have the corresponding attributions (by @snkashis). #2177 #2178
0.6.4 (July 25, 2013)
- Fixed a regression where
fitBounds
andsetMaxBounds
could freeze the browser in some situations. #1895 1866 - Fixed a bug where click on a map on a page with horizontal scroll caused the page to scroll right (by @mstrelan). #1901
0.6.3 (July 17, 2013)
Regression fixes
- Fixed a regression where mouse interaction had incorrect coordinates in some map positioning cases (by @scooterw). #1826 #1684 #1745 #1
- Fixed a regression that prevented the map from responding to drag on areas covered with
ImageOverlay
(by @jfirebaugh). #1821 - Fixed a regression where
layerremove
andlayeradd
were fired before the corresponding action finishes (by @jfirebaugh). #1846 - Fixed a regression with
worldCopyJump: true
breaking the map on small zoom levels (by @danzel). #1831 - Fixed a regression where
Marker
shadow didn't animate on zoom after usingsetIcon
. #1768 - Fixed a regression where the map would stuck when trying to animate zoom before any tile layers are added to the map. #1484 #1845
- Fixed a regression with the layers control and popups closing on inside click in IE < 9. #1850
- Fixed a regression where scrolled popup content woudln't scroll in FF (by @jfirebaugh).
Bug fixes
- Fixed vector feature flickering on Safari Mac for screen < 2000px. #902
- Fixed a bug where
GeoJSON
ignored non-feature geometries passed in an array. #1840 - Fixed a bug where
Map
minZoom
andmaxZoom
didn't always override values derived from the added tile layers. 1848 - Fixed a bug where
TileLayer.Canvas
wasn't immediately redrawn whenredraw
is called (by @tofferrosen). #1797 #1817 - Fixed a bug where
FeatureGroup
still firedlayerremove
event onremoveLayer
even if the given layer wan't present in the group (by (by @danzel)). #1847 #1858 - Fixed a bug where
Marker
setOpacity
wasn't returning the marker (by @freepius44). #1851 - Fixed a bug where removing the map element from the DOM before panning transition has finished could keep a setInterval loop running forever (by @rutkovsky). #1825 #1856
- Fixed mobile styles to apply to
leaflet-bar
elements.
Improvements
- Added ability to pass zoom/pan animation options to
setMaxBounds
(by @davidjb). #1834 - Added
MultiPolyline
andMultiPolygon
getLatLngs
method. #1839
Dev Workflow improvements
- Leaflet builds (*.js files in the
dist
folder) were removed from the repo and are now done automatically on each commit formaster
andstable
branches by Travis CI. The download links are on the Leafet download page.
0.6.2 (June 28, 2013)
- Fixed a bug that caused wrong tile layers stacking order when using opacity < 1 (by @jfirebaugh). #1804 #1790 #1667
- Fixed a regression that caused tiles selection when double-clicking absolutely positioned maps with vector layers in it in Firefox (WTF!) (by @jfirebaugh). #1807
- Fixed a regression with a wrong cursor when dragging a map with vector layers, and tiles becoming selected on double click (by @jfirebaugh). #1800
- Fixed a regression that caused flickering of tiles near map border on zoom animation in Chrome.
0.6.1 (June 27, 2013)
- Fixed a regression with mouse wheel zooming too fast on Firefox (by @jfirebaugh). #1788
- Fixed a regression with broken zooming on maps with EPSG3395 projection. #1796
- Fixed a bug where zoom buttons inherited Bootstrap link hover styles. #1791
0.6 (June 26, 2013)
Breaking changes
- Moved polyline editing code into Leaflet.draw plugin (where it fits much better along with all other editing and drawing handlers). The API remains the same.
- Dropped support for environments that augment
Object.prototype
(luckily it's a thing of the past nowadays). Map
invalidateSize
no longer firesmove
andmoveend
events if the map size didn't change. #1819
Improvements
Usability and performance improvements
- Improved zoom control design - cleaner, simpler, more accessible (mostly by @jacobtoye). #1313
- Updated
Control.Layers
icon (designed by Volker Kinkelin), added retina version and SVG source. #1739 - Added keyboard accessibility to markers (you can now tab to them and press enter for click behavior). #1355
- Improved
TileLayer
zoom animation to eliminate flickering in case one tile layer on top of another or when zooming several times quickly (by @mourner with lots of fixes from @danzel). #1140 #1437 #52 - Subtly improved default popup styles
- Improved attribution control to be much less obtrusive (no "powered by", just a Leaflet link). You can still remove the prefix with
map.attributionControl.setPrefix('')
if you need. - Improved zoom behavior so that there's no drift of coordinates when you change zoom back and forth without panning. #426
- Improved double click behavior to zoom while keeping the clicked point fixed (by @ansis). #1582
- Improved dragging behavior to not get stuck if mouse moved outside of an iframe containing the map (by @jfirebaugh). #1277 #1782 #1786
- Improved box zoom to be cancelable by pressing Escape (by @yohanboniface). #1438
- Improved
Marker
popups to close on marker click if opened (by @popox). #1761 - Significantly improved mass layer removal performance (by @jfgirard with fixes from @danzel). #1141 #1514
API improvements
Layers API improvements
- Added
toGeoJSON
method to various layer types, allowing you to save your Leaflet layers as GeoJSON. (by @jfirebaugh). #1462 #712 #1779 - Added
GeoJSON
coordsToLatLng
option for dealing with GeoJSON that has non-WGS84 coords (thanks to @moonlite). #888 #886 - Improved
Marker
to reuse icon DOM elements when changing icons on the fly (e.g. fixes problems when changing icon on mouse hover) (by @robpvn & @danzel). #1726 #561 #1753 #1754 - Added
latlng
property toMarker
mouse event data. #1613 - Added
LayerGroup
hasLayer
method (by @rvlasveld). #1282 #1300 - Added
LayerGroup
getLayers
method (by @tmcw). #1469 - Added
LayerGroup
getLayer
method (by @gumballhead). #1650 - Improved
LayerGroup
removeLayer
method to also accept layerid
(by @gumballhead). #1642 - Added
Path
pointerEvents
option for setting pointer-events on SVG-powered vector layers (by @inpursuit). #1053 - Improved
Polygon
to filter out last point if it's equal to the first one (to fix GeoJSON polygon issues) (by @snkashis). #1153 #1135 - Improved paths with
clickable: false
to allow mouse events to pass through to objects underneath (by @snkashis). #1384 #1281 - Improved
L.Util.template
(and correspondingly url-relatedTileLayer
options) to support functions for data values (by @olegsmith). #1554 - Added
TileLayer
getContainer
method (by @tmcw). #1433 - Fixed
TileLayer.Canvas
redraw
method chaining (by @jieter). #1287 - Added
TileLayer.WMS
crs
option to be able to use WMS of CRS other than the map CRS (by @kengu). #942 #945 - Added
popupopen
andpopupclose
events to various layers (by @Koc). #738 - Added
Popup
keepInView
option (thanks to @lapo-luchini) that prevents the popup from going off-screen while it's opened. #1308 #1052 - Added
Marker
togglePopup
method (by @popox). #1761 - Added
Popup
closeOnClick
option that overrides the sameMap
option for specific popups (by @jfirebaugh). #1669 - Improved
Marker
andPath
bindPopup
method to also acceptPopup
objects (by @snkashis). #1385 #1208 #1402 - Added
Marker
setPopupContent
method (by @snkashis). #1373
Map API improvements
- Improved all view changing methods of
Map
(setView
,panTo
,setZoom
,fitBounds
, etc.) to accept an options object, including the ability to precisely control zoom/pan animations they cause (force disable/enable, etc.). #1617 #1616 #340 #483 #1164 #1420 - Improved
Map
fitBounds
method to acceptpadding
(orpaddingTopLeft
andpaddingBottomRight
) options, allowing you to zoom to an area with a certain padding in pixels (usually left for controls). #859 - Improved
Map
invalidateSize
to accept options object (animate
andpan
, the latter controls if it pans the map on size change). (by @jacobtoye and @mourner). #1766 #1767 - Added
Map
setZoomAround
method for zooming while keeping a certain point fixed (used by scroll and double-click zooming). #1157 - Added
Map
remove
method to properly destroy the map and clean up all events, and added correspondingunload
event (by @jfirebaugh and @mourner). #1434 #1101 #1621 - Added
Map
tap
handler that now contains all mobile hacks for enabling quick taps and long holds andtapTolerance
option specifying the number of pixels you can shift your finger for click to still fire. - Added
Map
zoomAnimationThreshold
for setting the max zoom difference with which zoom animation can occur. #1377 - Improved
Map
openPopup
method to also accept(content, latlng)
signature as a shortcut. - Improved
Map
closePopup
method to optionally accept a popup object to close. #1641 - Improved
Map
stopLocate
method to abort resetting map view if callinglocate
withsetView
option. #747 - Improved
Map
to throw exception if the specified container id is not found (by @tmcw). #1574 - Improved
Map
locationfound
event to pass all location data (heading, speed, etc.). #984 #584 #987 #1028 - Added
Map
resize
event. #1564 - Added
Map
zoomlevelschange
event that triggers when the current zoom range (min/max) changes (by @moonlite). #1376
Controls API improvements
- Added generic toolbar classes for reuse by plugin developers (used by zoom control).
- Added
Map
baselayerchange
,overlayadd
andoverlayremove
events fired byControl.Layers
(by @calvinmetcalf and @Xelio). #1286 #1634 - Added
Control
getContainer
method. #1409
Misc API improvements
- Made Leaflet classes compatible with CoffeeScript class inheritance syntax (by @calvinmetcalf). #1345 #1314
- Added
cleanAllEventListeners
method (aliased tooff
without arguments) to all events-enabled objects (by @iirvine). #1599 - Added
addOneTimeEventListener
method (aliased toonce
) to all events-enabled objects (by @iirvine). #473 #1596 - Added ability to pass coordinates as simple objects (
{lat: 50, lon: 30}
or{lat: 50, lng: 30}
). #1412 - Added
LatLngBounds
getNorth
,getEast
,getSouth
,getWest
methods (by @yohanboniface). #1318 - Added
AMD
support (Leaflet now registers itself as aleaflet
AMD module) (with fixes from @sheppard). #1364 #1778 - Added
L.Util.trim
function (by @kristerkari). #1607
Development workflow improvements
- Switched from Jasmine to Mocha with Expect.js (matchers) and Sinon (spies) for tests (by @tmcw & @jfirebaugh). #1479
- Added Karma integration for running tests in a headless PhantomJS instance and code coverage reporting (by @edjafarov). #1326 #1340
- Added Travis CI integration for linting and running tests for each commit and pull request automatically (by @edjafarov). #1336
- Significantly improved test coverage
- Added compatibility with lazy evaluation scripts (by @kristerkari). #1288 #1607 #1288
Bugfixes
General bugfixes
- Fixed lots of issues with extent restriction by
Map
maxBounds
. #1491 #1475 #1194 #900 #1333 - Fixed occasional crashes by disabling zoom animation if changing zoom level by more than 4 levels. #1377
- Fixed a bug with that caused stuttery keyboard panning in some cases (by @tmcw). #1710
- Fixed a bug that caused unwanted scrolling of the page to the top of the map on focus. #1228 #1540
- Fixed a bug where clicking on a marker with an open popup caused the popup to faded in again (by @snkashis). #506 #1386
- Fixed a bug where zoom buttons disabled state didn't update on min/max zoom change (by @snkashis). #1372 #1328
- Fixed a bug where scrolling slightly wouldn't always zoom out the map (by @cschwarz). #1575
- Fixed popup close button to not leave an outline after clicking on it and reopening the popup (by @dotCypress). #1537
- Fixed a bug that prevented tiles from loading during pan animation.
- Fixed a bug with
contextmenu
events on popups falling through to map (by @snkashis). #1730 #1732 - Fixed
404
tile loading errors when browsing the map off the world bounds. - Fixed shifted mouse events in some cases with map inside a relatively positioned parent (by @scooterw and @jec006). #1670 #1684 #1745 #1744
- Fixed a bug where tile layer z-index order sometimes broke after view reset. #1422
Browser bugfixes
- Fixed a bug with undesirable page scrolling in Firefox 17+ when you zoom the map by scrolling (by @jfirebaugh). #1789 #1788
- Fixed a bug where mouse coordinates where shifted in Firefox if the map was inside a positioned block on a scrolled page (by @joschka). #1365 #1322
- Fixed a bug where box zoom didn't work in some cases in Firefox 18+ (by @fabriceds). #1405
- Fixed a bug where
TileLayer
opacity didn't work in IE 7-8 (by @javisantana & [@danzel](https://gi .com/danzel)). #1084 #1396 #1371 - Fixed Leaflet not working correctly in PhantomJS (by @rassie). #1501
Mobile bugfixes
- Fixed a bug with layers control on WinPhone8/IE10 Touch (by @danzel). #1635 #1539
- Fixed a bug with click sometimes firing twice on WinPhone8/IE10 Touch (by @danzel). #1694
- Fixed a bug in Android where click was triggered twice on one tap (by @jerel & @mourner). #1227 #1263 #1785 #1694
- Fixed a bug in Android where click on a collapsed layers control would immediately select one of the layers (by @danzel). #1784 #1694
API bugfixes
General API bugfixes
- Fixed click mouse event inside popups not propagating outside the map (fixes issues with jQuery.live and some mobile frameworks that rely on document click listeners). #301
- Fixed a bug where event listener still fired even if it was removed on the same event in other listener (by @spamdaemon). #1661 #1654
- Fixed a bug where
L.point
andL.latLng
factories weren't passingnull
andundefined
values through. - Fixed
DomEvent
removeListener
function chaining (by @pagameba). - Fixed a bug where
removeEventListener
would throw an error if no events are registered on the object (by @tjoekbezoer). #1632 #1631 - Fixed a bug where
Point
equals
andcontains
methods didn't accept points in array form. - Fixed a bug where
LatLngBounds
extend
of an undefined object would cause an error (by @korzhyk). #1688 - Fixed a bug where
Control.Attribution
removeAttribution
of inexistant attribution corrupted the attribution text. #1410 - Fixed a bug where
setView
on an invisible map caused an error (by @jfire). #1707 - Fixed compatibility with Browserify (by @jfirebaugh). #1572
Layers API bugfixes
- Fixed a bug where default marker icon path wasn't properly detected in some cases in IE6-7 (by @calvinmetcalf). #1294
- Fixed a bug where
TileLayer.WMS
param values weren't escaped in URLs (by @yohanboniface). #1317 - Fixed a bug where layers that belong to multiple feature groups didn't propagate events correctly (by @danzel). #1359
- Fixed a bug where
TileLayer.WMS
tileSize
option was ignored (by @brianhatchl). #1080 - Fixed a bug where
Polyline
constructor could overwrite the source array (by @snkashis and @danzel). #1439 #1092 #1246 #1426 - Fixed a bug where marker dragging disabling/enabling wouldn't always work correctly (by @snkashis and @escaped). #1471 #1551
- Fixed
TileLayer
to prevent incorrect subdomain in case of negative tile coordinates (by @malexeev). #1532 - Fixed polygons to normalize holes (remove last point if it's equal to the first one) (by @jfirebaugh). # #1459
- Fixed
DivIcon
html
option to accept0
as a value (by @stuporglue). #1633 - Fixed a bug with Canvas-based paths throwing an error on
mousemove
in certain conditions. #1615 - Fixed a bug where copies of the world wouldn't load if you set
TileLayer
bounds
(by @ansis). #1618 - Fixed a bug where
TileLayer
load
event wouldn't always fire correctly. #1565 - Fixed
TileLayer.WMS
compatibility with some old servers that only accepted request parameters in uppercase. #1751 - Fixed a bug with incorrect
L.Icon.Default.imagePath
detection in some cases. #1657 - Fixed a bug where layer
onRemove
was still called even if it was never added (by @jfirebaugh). #1729 - Fixed a bug where calling
setRadius
on a Canvas-poweredCircleMarker
would cause an infinite loop (by @snkashis). #1712 #1713 #1728 - Renamed
marker-icon@2x.png
tomarker-icon-2x.png
to fix compatibility with Google AppEngine. #1552 #1553 - Fixed a bug where
popupclose
andpopupopen
events weren't fired for multipolygons and multipolylines (by @tmcw). #1681
Map API bugfixes
- Fixed a bug where
Map
fitBounds
wouldn't work correctly with large bounds (thanks to @MaZderMind). #1069 - Fixed a bug where
Map
hasLayer
wasn't handlingnull
objects (by @rvlasveld). #1282 #1302 - Fixed a bug where
Map
moveend
fired beforedragend
on drag (by @oslek). #1374 - Fixed a bug where panning with inertia produced an excessive
Map
movestart
event on inertia start (by @oslek). #1374 - Fixed a bug where
Map
moveend
fired repeatedly on window resize even if the actual map size didn't change (by @oslek). #1374 - Fixed a bug where
Map
moveend
sometimes wasn't fired after drag (particularly often when dragging with a trackpad). - Fixed a bug that would cause an error when trying to get the state of the map in a
Map
load
event listener. #962 - Added
Map
autopanstart
event back (it was removed occasionally in previous version). #1375 - Fixed a bug with removing previously set
Map
maxBounds
(by @jec006). #1749 #1750
0.5.1 (February 6, 2013)
- Fixed a regression with
GeoJSON
not accepting arrays ofFeatureCollection
(by @snkashis). #1299 #1298 - Fixed a regression with
CirleMarker
setRadius
not working if called before adding the layer to the map (by @danzel). #1342 #1297
0.5 (January 17, 2013)
Breaking changes
Be sure to read through these changes to avoid any issues when upgrading from older versions:
- Removed default
LatLng
wrapping/clamping of coordinates (-180, -90
to180, 90
), wrapping moved to an explicit method (LatLng
wrap
). - Disabled
Map
worldCopyJump
option by default (jumping back to the original world copy when panning out of it). Enable it explicitly if you need it. - Changed styles for the zoom control (you may need to update your custom styles for it).
Improvements
Usability improvements
Interaction
- Added touch zoom, pan and double tap support for IE10 touch devices and Metro apps (by @danzel and @veproza with help from @oliverheilig). #1076 #871
- Improved panning inertia to be much more natural and smooth.
- Improved dragging cursors in Chrome, Safari and Firefox (now grabbing hand cursors are used).
- Improved zoom animation curve for a better feel overall.
- Improved scroll wheel zoom to be more responsive.
- Improved panning animation performance in IE6-8.
Controls
- Improved zoom control design to look better, more neutral and in line with other controls, making it easier to customize and fit different website designs. Replaced +/- images with text.
- Improved zoom control to zoom by 3 levels if you hold shift while clicking on a button.
- Improved zoom control buttons to become visually disabled when min/max zoom is reached. #917
- Improved scale control styles.
- Improved fallback control styles for IE6-8.
Other
- Added retina support for markers (through
Icon
iconRetinaUrl
andshadowRetinaUrl
options) (by @danzel). #1048 #1174 - Added retina-sized default marker icon in addition to standard one (along with its SVG source and with some subtle design improvements) (by @danzel). #1048 #1174
- Improved vectors updating/removing performance on Canvas backend (by @danzel). #961
- Cut total images size from 10KB to 3.2KB with Yahoo Smush.it. Thanks to Peter Rounce for suggestion.
API improvements
- Replaced
L.Transition
with a much better and simplerL.PosAnimation
. - Added
Class
addInitHook
method for adding constructor hooks to any classes (great extension point for plugin authors). #1123 - Added
Map
whenReady
method (by @jfirebaugh). #1063 - Added optional
delta
argument toMap
zoomIn
andzoomOut
(1 by default). - Added
isValid
method toLatLngBounds
andBounds
(by @domoritz). #972 - Added
Point
equals
method. - Added
Bounds
getSize
method. - Improved markers and vectors click event so that it propagates to map if no one is listening to it (by @danzel). #834 #1033
- Added
Path
unbindPopup
andclosePopup
methods. - Added
Path
add
andremove
event. - Added
Marker
riseOnHover
andriseOffset
options (for bringing markers to front on hover, disabled by default) (by jacobtoye). #914 #920 - Added
Marker
move
andremove
events. - Added
Marker
contextmenu
event. #223 - Added
Popup
zoomAnimation
option (useful to disable when displaying flash content inside popups #999). - Added
FeatureGroup
layeradd
andlayerremove
events (by @jacobtoye). #1122 - Added
Control.Layers
baselayerchange
event (by @jfirebaugh). #1064 - Improved
Control.Layers
to support HTML in layer names (by @aparshin). #1055 #1099 - Added
CRS.Simple
to the list of built-in CRS and improved it to be more usable out of the box (it has different default scaling and transformation now), seedebug/map/simple-proj.html
for an example. - Removed
Browser
ua
,gecko
,opera
properties (no longer needed). - Added
L.extend
,L.bind
,L.stamp
,L.setOptions
shortcuts for correspondingL.Util
methods. - Disabled clearing of map container contents on map initialization (as a result of fixing #278).
- Added
L.Util.isArray
function (by @oslek). #1279 - Added
mouseover
andmouseout
events to canvas-based vector layers (by @snkashis). #1403 - Added
Map
eachLayer
to iterate over all layers added to the map (by @jfirebaugh). #1457 - Added
TileLayer
bounds
option to limit tile loading to a specific region (by @adimitrov). #991
Bugfixes
General bugfixes
- Fixed broken tiles and zooming in RTL layouts (by @danzel). #1099 #1095
- Fixed a bug with pan animation where it jumped to its end position if you tried to drag the map.
- Fixed a bug where shift-clicking on a map would zoom it to the max zoom level.
- Fixed a glitch with zooming in while panning animation is running.
- Fixed a glitch with dragging the map while zoom animation is running.
- Fixed a bug where slight touchpad scrolling or one-wheel scrolling wouln't always perform zooming. #1039
- Fixed a bug where
panBy
wouldn't round the offset values (so it was possible to make the map blurry with it). #1085 - Fixed a bug where you couldn't scroll the layers control with a mouse wheel.
- Fixed a regression where WMS tiles wouldn't wrap on date lines. #970
- Fixed a bug where mouse interaction was affected by map container border width (by @mohlendo). #1204 #1205
- Fixed a bug with weird vector zoom animation when using Canvas for rendering (by @danzel). #1187 #1188
- Fixed a bug where max bounds limitation didn't work when navigating the map with a keyboard (by @snkashis). #989 #1221
API bugfixes
- Fixed a bug where
TileLayer
bringToBack
didn't work properly in some cases (by @danzel). #963 #959 - Fixed a bug where removing a tile layer while dragging would throw an error (by @danzel). #965 #968
- Fixed a bug where middle marker wasn't removed after deleting 2 end nodes from a polyline (by @Svad). #1022 #1023
- Fixed a bug where
Map
load
event happened too late (aftermoveend
, etc.) (by @jfirebaugh). #1027 - Fixed
Circle
getBounds
to return correct bounds and work without adding the circle to a map. #1068 - Fixed a bug where removing
Popup
onviewreset
throwed an error (by fnicollet and @danzel). #1098 #1094 - Fixed a bug where
TileLayer.Canvas
drawTile
didn't receive tile zoom level in arguments. - Fixed a bug where
GeoJSON
resetStyle
would not fully reset a layer to its default style. #1112 - Fixed a bug that caused infinite recursion when using
latLngBounds
factory with coordinates as string values. #933 - Fixed chaining on
Marker
setIcon
,setZIndexOffset
,update
methods. #1176 - Fixed a bug with mouse interaction when the map container contained children with position other than absolute. #278
- Fixed a bug with fill/stroke opacity conflicts when using Canvas for rendering (by @danzel). #1186 #1889
- Fixed a bug where
FeatureGroup
bindPopup
didn't take options into account. - Fixed a bug where Canvas-based vector layers didn't cleanup click event on removal properly (by @snkashis). #1006 #1273
- Fixed a bug where
CircleMarker
setStyle
didn't takeradius
into account (by @fdlk). #1012 #1013 - Fixed a bug where null GeoJSON geometries would throw an error instead of skipping (by @brianherbert). #1240
- Fixed a bug where Canvas-based vector layers passed incorrect
layer
event property on click (by @snkashis). #1215 #1243 - Fixed a bug where
TileLayer.WMS
didn't work correctly if the base URL contained query parameters (by @snkashis). #973 #1231 - Fixed a bug where removing a polyline in editing state wouldn't clean up the editing handles (by @mehmeta). #1233
- Fixed a bug where removing a vector layer with a bound popup wouldn't clean up its click event properly (by @yohanboniface). #1229
- Fixed a bug where
GeoJSON
features withGeometryCollection
didn't pass properties topointToLayer
function (by @calvinmetcalf). #1097 - Fixed
FeatureGroup
eachLayer
chaining. #1452
Browser bugfixes
- Fixed a bug with map freezing after zoom on Android 4.1. #1182
- Fixed a bug where "Not implemented" error sometimes appeared in IE6-8 (by @bryguy and @lookfirst). #892 #893
- Fixed compatibility with SmoothWheel extension for Firefox (by @waldir). #1011
- Fixed a bug with popup layout in IE6-7 (by @danzel). #1117
- Fixed a bug with incorrect box zoom opacity in IE6-7 (by @jacobtoye). #1072
- Fixed a bug with box zoom throwing a JS error in IE6-7 (by @danzel). #1071
- Fixed a bug where
TileLayer
bringToFront/Back()
throwed an error in IE6-8. #1168 - Fixed array type checking in the code to be more consistent in a cross-frame environment (by @oslek). #1279
- Fixed a bug with
-
key not working in Firefox 15+ (thanks to @mattesCZ). #869
0.4.5 (October 25, 2012)
- Fixed a bug with wonky zoom animation in IE10 (by @danzel). #1007
- Fixed a bug with wonky zoom animation in Chrome 23+ (by @danzel). #1060 #1056
0.4.4 (August 7, 2012)
Improvements
- Improved
GeoJSON
setStyle
to also accept function (like the corresponding option). - Added
GeoJSON
resetStyle(layer)
, useful for resetting hover state. - Added
feature
property to layers created withGeoJSON
(containing the GeoJSON feature data). - Added
FeatureGroup
bringToFront
andbringToBack
methods (so that they would work for multipolys). - Added optional
animate
argument toMap
invalidateSize
(by @ajbeaven). #857
Bugfixes
- Fixed a bug where tiles sometimes disappeared on initial map load on Android 2/3 (by @danzel). #868
- Fixed a bug where map would occasionally flicker near the border on zoom or pan on Chrome.
- Fixed a bug where
Path
bringToFront
andbringToBack
didn't returnthis
. - Removed zoom out on Win/Meta key binding (since it interferes with global keyboard shortcuts). #869
0.4.2 (August 1, 2012)
- Fixed a bug where layers control radio buttons would not work correctly in IE7 (by @danzel). #862
- Fixed a bug where
FeatureGroup
removeLayer
would unbind popups of removed layers even if the popups were not put by the group (affected Leaflet.markercluster plugin) (by @danzel). #861
0.4.1 (July 31, 2012)
- Fixed a bug that caused marker shadows appear as opaque black in IE6-8. #850
- Fixed a bug with incorrect calculation of scale by the scale control. #852
- Fixed broken L.tileLayer.wms class factory (by @mattcurrie). #856
- Improved retina detection for
TileLayer
detectRetina
option (by @sxua). #854
0.4 (July 30, 2012)
API simplification
Leaflet 0.4 contains several API improvements that allow simpler, jQuery-like syntax (example) while being backwards compatible with the previous approach (so you can use both styles):
- Improved most methods and options to accept
LatLng
,LatLngBounds
,Point
andBounds
values in an array form (e.g.map.panTo([lat, lng])
will be the same asmap.panTo(new L.LatLng(lat, lng))
) - Added
addTo
method to all layer classes, e.g.marker.addTo(map)
is equivalent tomap.addLayer(marker)
- Added factory methods to most classes to be able to write code without
new
keyword, named the same as classes but starting with a lowercase letter, e.g.L.map('map')
is the same asnew L.Map('map')
Notable new features
- Added configurable panning inertia - after a quick pan, the map slows down in the same direction.
- Added keyboard navigation for panning/zooming with keyboard arrows and +/- keys (by @ericmmartinez). #663 #646
- Added smooth zoom animation of markers, vector layers, image overlays and popups (by @danzel). #740 #758
- Added Android 4+ pinch-zoom support (by @danzel). #774
- Added polyline and polygon editing. #174
- Added an unobtrusive scale control.
- Added DivIcon class that easily allows you to create lightweight div-based markers.
- Added Rectangle vector layer (by @JasonSanford). #504
Improvements
Usability improvements
- Improved zooming so that you don't get a blank map when you zoom in or out twice quickly (by @danzel). #7 #729
- Drag-panning now works even when there are markers in the starting point (helps on maps with lots of markers). #506
- Improved panning performance even more (there are no wasted frames now).
- Improved pinch-zoom performance in mobile Chrome and Firefox.
- Improved map performance on window resize.
- Replaced box-shadow with border on controls for mobile devices to improve performance.
- Slightly improved default popup styling.
- Added
TileLayer
detectRetina
option (false
by default) that makes tiles show in a higher resolution on iOS retina displays (by @Mithgol). #586
GeoJSON API changes
GeoJSON API was improved to be simpler and more flexible (example). The changes are not backwards-compatible, so be sure to update your old code.
- Added
style
option for styling vector layers, passed either as an object or as a function (to style vector layers according to GeoJSON properties). - Added
filter
option to leave out features that don't correspond to a certain criteria (e.g. based on properties). - Added
onEachFeature
option to execute certain code on each feature layer based on its properties (binding popups, etc). - Changed
pointToLayer
function signature to providegeojson
in addition tolatlng
when creating point features for more flexibility.
Icon API changes
Icon API was improved to be more flexible, but one of the changes is backwards-incompatible: you now need to pass different icon properties (like iconUrl
) inside an options object (example).
- Converted
Icon
properties to options, changed constructor signature toIcon(options)
. - Moved default marker icon options to
L.Icon.Default
class (which extends fromL.Icon
). - Added
Icon
className
option to assign a custom class to an icon. - Added
Icon
shadowAnchor
option to set the anchor of the shadow. - Made all
Icon
options excepticonUrl
optional (if not specified, they'll be chosen automatically or implemented using CSS). Anchor is centered by default (if size is specified), and otherwise can be set through CSS using negative margins.
Control API changes
- Added
setPosition
andgetPosition
to all controls, as well as ability to pass certain position as an option when creating a control. - Made controls implementation easier (now more magic happens under the hood).
- Replaced ugly control position constants (e.g.
L.Control.Position.TOP_LEFT
) with light strings ('topleft'
,'bottomright'
, etc.)
Other breaking API changes
- Improved
TileLayer
constructor to interpolate URL template values from options (removed thirdurlParams
argument). - Changed
TileLayer
scheme: 'tms'
option totms: true
. - Removed
Map
locateAndSetView
method (uselocate
withsetView: true
option) - Changed popup
minWidth
andmaxWidth
options to be applied to content element, not the whole popup. - Moved
prefix
argument tooptions
inControl.Attribution
constructor. - Renamed
L.VERSION
toL.version
.
Other API improvements
- Improved
on
andoff
methods to also accept(eventHash[, context])
, as well as multiple space-separated events (by @Guiswa). #770 - Improved
off
to remove all listeners of the event if no function was specified (by @Guiswa). #770 #691 - Added
TileLayer
setZIndex
method for controlling the order of tile layers (thanks to @mattcurrie). #837 - Added
Control.Layers
autoZIndex
option (on by default) to preserve the order of tile layers when switching. - Added
TileLayer
redraw
method for re-requesting tiles (by @greeninfo). #719 - Added
TileLayer
setUrl
method for dynamically changing the tile URL template. - Added
bringToFront
andbringToBack
methods toTileLayer
,ImageOverlay
and vector layers. #185 #505 - Added
TileLayer
loading
event that fires when its tiles start to load (thanks to @lapinos03). #177 - Added
TileLayer.WMS
setParams
method for setting WMS parameters at runtime (by @greeninfo). #719 - Added
TileLayer.WMS
subdomain support ({s}
in the url) (by @greeninfo). #735 - Added
originalEvent
property toMouseEvent
(by @k4). #521 - Added
containerPoint
property toMouseEvent
. #413 - Added
contextmenu
event to vector layers (by @ErrorProne). #500 - Added
LayerGroup
eachLayer
method for iterating over its members. - Added
FeatureGroup
mousemove
andcontextmenu
events (by @jacobtoye). #816 - Added chaining to
DomEvent
methods. - Added
on
andoff
aliases forDomEvent
addListener
andremoveListener
methods. - Added
L_NO_TOUCH
global variable switch (set it before Leaflet inclusion) which disables touch detection, helpful for desktop apps built using QT. #572 - Added
dashArray
option to vector layers for making dashed strokes (by jacobtoye). #821 #165 - Added
Circle
getBounds
method. #440 - Added
Circle
getLatLng
andgetRadius
methods (by @Guiswa). #655 - Added
openPopup
method to all vector layers. #246 - Added public
redraw
method to vector layers (useful if you manipulate theirLatLng
points directly). - Added
Marker
opacity
option andsetOpacity
method. - Added
Marker
update
method. #392 - Improved
Marker
openPopup
not to raise an error if it doesn't have a popup. #507 - Added
ImageOverlay
opacity
option andsetOpacity
method. #438 - Added
Popup
maxHeight
option that makes content inside the popup scrolled if it doesn't fit the specified max height. - Added
Popup
openOn(map)
method (similar toMap
openPopup
). - Added
Map
getContainer
method (by @Guiswa). #654 - Added
Map
containerPointToLatLng
andlatLngToContainerPoint
methods. #474 - Added
Map
addHandler
method. - Added
Map
mouseup
andautopanstart
events. - Added
LatLngBounds
pad
method that returns bounds extended by a percentage (by @jacobtoye). #492 - Moved dragging cursor styles from JS code to CSS.
Bug fixes
General bugfixes
- Fixed a bug where the map was zooming incorrectly inside a
position: fixed
container (by @chx007). #602 - Fixed a bug where scaled tiles weren't cleared up after zoom in some cases (by @cfis) #683
- Fixed a bug where map wouldn't drag over a polygon with a
mousedown
listener. #834
API bugfixes
- Fixed a regression where removeLayer would not remove corresponding attribution. #488
- Fixed a bug where popup close button wouldn't work on manually added popups. #423
- Fixed a bug where marker click event would stop working if you dragged it and then disabled dragging. #434
- Fixed a bug where
TileLayer
setOpacity
wouldn't work when setting it back to 1. - Fixed a bug where vector layer
setStyle({stroke: false})
wouldn't remove stroke and the same for fill. #441 - Fixed a bug where
Marker
bindPopup
method wouldn't takeoffset
option into account. - Fixed a bug where
TileLayer
load
event wasn't fired if some tile didn't load (by @lapinos03 and @cfis) #682 - Fixed error when removing
GeoJSON
layer. #685 - Fixed error when calling
GeoJSON
clearLayer
(by @runderwood). #617 - Fixed a bug where
Control
setPosition
wasn't always working correctly (by @ericmmartinez). #657 - Fixed a bug with
Util.bind
sometimes losing arguments (by @johtso). #588 - Fixed a bug where
drag
event was sometimes fired afterdragend
. #555 - Fixed a bug where
TileLayer
load
event was firing only once (by @lapinos03 and shintonik). #742 #177 - Fixed a bug where
FeatureGroup
popup events where not cleaned up after removing a layer from it (by @danzel). #775 - Fixed a bug where
DomUtil.removeClass
didn't remove trailing spaces (by @jieter). #784 - Fixed a bug where marker popup didn't take popup offset into account.
- Fixed a bug that led to an error when polyline was removed inside a
moveend
listener. - Fixed a bug where
LayerGroup
addLayer
wouldn't check if a layer has already been added (by @danzel). 798
Browser bugfixes
- Fixed broken zooming on IE10 beta (by @danzel). #650 #751
- Fixed a bug that broke Leaflet for websites that had XHTML content-type header set (by lars-sh). #801
- Fixed a bug that caused popups to be empty in IE when passing a DOM node as the content (by @nrenner). #472
- Fixed inability to use scrolled content inside popup due to mouse wheel propagation.
- Fixed a bug that caused jumping/stuttering of panning animation in some cases.
- Fixed a bug where popup size was calculated incorrectly in IE.
- Fixed a bug where cursor would flicker when dragging a marker.
- Fixed a bug where clickable paths on IE9 didn't have a hand cursor (by naehrstoff). #671
- Fixed a bug in IE with disappearing icons when changing opacity (by @tagliala and DamonOehlman). #667 #600
- Fixed a bug with setting opacity on IE10 (by @danzel). 796
- Fixed a bug where
Control.Layers
didn't work on IE7. #652 - Fixed a bug that could cause false
mousemove
events on click in Chrome (by @stsydow). #757 - Fixed a bug in IE6-8 where adding fill or stroke on vector layers after initialization with
setStyle
would break the map. #641 - Fixed a bug with setOpacity in IE where it would not work correctly if used more than once on the same element (by @ajbeaven). #827
- Fixed a bug in Chrome where transparent control corners sometimes couldn't be clicked through (by @danzel). #836 #575
Mobile browser bugfixes
- Fixed a bug that sometimes caused map to disappear completely after zoom on iOS (by @fr1n63). #580 #777
- Fixed a bug that often caused vector layers to flicker on drag end on iOS (by @krawaller). #18
- Fixed a bug with false map click events on pinch-zoom and zoom/layers controls click. #485
- Fixed a bug where touching the map with two or more fingers simultaneously would raise an error.
- Fixed a bug where zoom control wasn't always visible on Android 3. #335
- Fixed a bug where opening the layers control would propagate a click to the map (by @jacobtoye). #638
- Fixed a bug where
ImageOverlay
wouldn't stretch properly on zoom on Android 2. #651 - Fixed a bug where
clearLayers
for vector layers on a Canvas backend (e.g. on Android 2) would take unreasonable amount of time. #785 - Fixed a bug where
setLatLngs
and similar methods on vector layers on a Canvas backend would not update the layers immediately. #732
0.3.1 (February 14, 2012)
- Fixed a regression where default marker icons wouldn't work if Leaflet include url contained a query string.
- Fixed a regression where tiles sometimes flickered with black on panning in iOS.
0.3 (February 13, 2012)
Major features
- Added Canvas backend for vector layers (polylines, polygons, circles). This enables vector support on Android < 3, and it can also be optionally preferred over SVG for a performance gain in some cases. Thanks to @florianf for a big part of this work.
- Added layers control (
Control.Layers
) for convenient layer switching. - Added ability to set max bounds within which users can pan/zoom. #93
Improvements
Usability improvements
- Map now preserves its center after resize.
- When panning to another copy of the world (that's infinite horizontally), map overlays now jump to corresponding positions. #273
- Limited maximum zoom change on a single mouse wheel movement (so you won't zoom across the whole zoom range in one scroll). #149
- Significantly improved line simplification performance (noticeable when rendering polylines/polygons with tens of thousands of points)
- Improved circles performance by not drawing them if they're off the clip region.
- Improved stability of zoom animation (less flickering of tiles).
API improvements
- Added ability to add a tile layer below all others (
map.addLayer(layer, true)
) (useful for switching base tile layers). - Added
Map
zoomstart
event (thanks to @Fabiz). #377 - Improved
Map
locate
method, added ability to watch location continuously and more options. #212 - Added second argument
inside
toMap
getBoundsZoom
method that allows you to get appropriate zoom for the view to fit inside the given bounds. - Added
hasLayer
method toMap
. - Added
Marker
zIndexOffset
option to be able to set certain markers below/above others. #65 - Added
urlParams
third optional argument toTileLayer
constructor for convenience: an object with properties that will be evaluated in the URL template. - Added
TileLayer
continuousWorld
option to disable tile coordinates checking/wrapping. - Added
TileLayer
tileunload
event fired when tile gets removed after panning (by @CodeJosch). #256 - Added
TileLayer
zoomOffset
option useful for non-256px tiles (by @msaspence). - Added
TileLayer
zoomReverse
option to reverse zoom numbering (by @Majiir). #406 - Added
TileLayer.Canvas
redraw
method (by @mortenbekditlevsen). #459 - Added
Polyline
closestLayerPoint
method that's can be useful for interaction features (by @anru). #186 - Added
setLatLngs
method toMultiPolyline
andMultiPolygon
(by @anru). #194 - Added
getBounds
method toPolyline
andPolygon
(by @JasonSanford). #253 - Added
getBounds
method toFeatureGroup
(by @JasonSanford). #557 - Added
FeatureGroup
setStyle
method (also inherited byMultiPolyline
andMultiPolygon
). #353 - Added
FeatureGroup
invoke
method to call a particular method on all layers of the group with the given arguments. - Added
ImageOverlay
load
event. #213 - Added
minWidth
option toPopup
(by @marphi). #214 - Improved
LatLng
constructor to be more tolerant (and throw descriptive error if latitude or longitude can't be interpreted as a number). #136 - Added
LatLng
distanceTo
method (great circle distance) (by @mortenbekditlevsen). #462 - Added
LatLngBounds
toBBoxString
method for convenience (by @JasonSanford). #263 - Added
LatLngBounds
intersects(otherBounds)
method (thanks to @pagameba). #350 - Made
LatLngBounds
extend
method to accept otherLatLngBounds
in addition toLatLng
(by @JasonSanford). #553 - Added
Bounds
intersects(otherBounds)
method. #461 - Added
L.Util.template
method for simple string template evaluation. - Added
DomUtil.removeClass
method (by @anru). - Improved browser-specific code to rely more on feature detection rather than user agent string.
- Improved superclass access mechanism to work with inheritance chains of 3 or more classes; now you should use
Klass.superclass
instead ofthis.superclass
(by @anru). #179 - Added
Map
boxzoomstart
andboxzoomend
events (by @zedd45). #554 - Added
Popup
contentupdate
event (by @mehmeta). #548
Breaking API changes
shiftDragZoom
map option/property renamed toboxZoom
.- Removed
mouseEventToLatLng
method (bringed back in 0.4).
Development workflow improvements
- Build system completely overhauled to be based on Node.js, Jake, JSHint and UglifyJS.
- All code is now linted for errors and conformity with a strict code style (with JSHint), and wont build unless the check passes.
Bugfixes
General bugfixes
- Fixed a bug where
Circle
was rendered with incorrect radius (didn't take projection exagerration into account). #331 - Fixed a bug where
Map
getBounds
would work incorrectly on a date line cross. #295 - Fixed a bug where polygons and polylines sometimes rendered incorrectly on some zoom levels. #381
- Fixed a bug where fast mouse wheel zoom worked incorrectly when approaching min/max zoom values.
- Fixed a bug where
GeoJSON
pointToLayer
option wouldn't work in aGeometryCollection
. #391 - Fixed a bug with incorrect rendering of GeoJSON on a date line cross. #354
- Fixed a bug where map panning would stuck forever after releasing the mouse over an iframe or a flash object (thanks to @sten82). #297 #64
- Fixed a bug where mouse wheel zoom worked incorrectly if map is inside scrolled container (partially by @chrillo). #206
- Fixed a bug where it was possible to add the same listener twice. #281
- Fixed a bug where
Circle
was rendered with incorrect radius (didn't take projection exaggeration into account). #331 - Fixed a bug where
Marker
setIcon
was not working properly (by @marphi). #218 #311 - Fixed a bug where
Marker
setLatLng
was not working if it's set before adding the marker to a map. #222 - Fixed a bug where marker popup would not move on
Marker
setLatLng
(by @tjarratt). #272 - Fixed a bug where static properties of a child class would not override the parent ones.
- Fixed broken popup
closePopup
option (by @jgerigmeyer). - Fixed a bug that caused en error when dragging marker with icon without shadow (by @anru). #178
- Fixed a typo in
Bounds
contains
method (by @anru). #180 - Fixed a bug where creating an empty
Polygon
withnew L.Polygon()
would raise an error. - Fixed a bug where drag event fired before the actual movement of layer (by @anru). #197
- Fixed a bug where map click caused an error if dragging is initially disabled. #196
- Fixed a bug where map
movestart
event would fire after zoom animation. - Fixed a bug where attribution prefix would not update on
setPrefix
. #195 - Fixed a bug where
TileLayer
load
event wouldn't fire in some edge cases (by @dravnic). - Fixed a bug related to clearing background tiles after zooming (by @neno-giscloud & @dravnic).
- Fixed a bug that sometimes caused map flickering after zoom animation.
- Fixed a bug related to cleaning up after removing tile layers (by @dravnic). #276
- Fixed a bug that made selecting text in the attribution control impossible. #279
- Fixed a bug when initializing a map in a non-empty div. #278
- Fixed a bug where
movestart
didn't fire on panning animation. - Fixed a bug in Elliptical Mercator formula that affeted
EPSG:3395
CRS (by @Savvkin). #358
Browser bugfixes
- Fixed occasional crashes on Mac Safari (thanks to @lapinos03). #191
- Fixed a bug where resizing the map would sometimes make it blurry on WebKit (by @mortenbekditlevsen). #453
- Fixed a bug that raised error in IE6-8 when clicking on popup close button. #235
- Fixed a bug with Safari not redrawing UI immediately after closing a popup. #296
- Fixed a bug that caused performance drop and high CPU usage when calling
setView
orpanTo
to the current center. #231 - Fixed a bug that caused map overlays to appear blurry in some cases under WebKit browsers.
- Fixed a bug that was causing errors in some Webkit/Linux builds (requestAnimationFrame-related), thanks to Chris Martens.
Mobile browser bugfixes
- Fixed a bug that caused an error when clicking vector layers under iOS. #204
- Fixed crash on Android 3+ when panning or zooming (by @florian). #137
- Fixed a bug on Android 2/3 that sometimes caused the map to disappear after zooming. #69
- Fixed a bug on Android 3 that caused tiles to shift position on a big map.
- Fixed a bug that caused the map to pan when touch-panning inside a popup. #452
- Fixed a bug that caused click delays on zoom control.
0.2.1 (2011-06-18)
- Fixed regression that caused error in
TileLayer.Canvas
.
0.2 (2011-06-17)
Major features
- Added WMS support (
TileLayer.WMS
layer). - Added different projections support, having
EPSG:3857
,EPSG:4326
andEPSG:3395
out of the box (throughcrs
option inMap
). Thanks to @Miroff & @Komzpa for great advice and explanation regarding this. - Added GeoJSON layer support.
Improvements
Usability improvements
- Improved panning performance in Chrome and FF considerably with the help of
requestAnimationFrame
. #130 - Improved click responsiveness in mobile WebKit (now it happens without delay). #26
- Added tap tolerance (so click happens even if you moved your finger slighly when tapping).
- Improved geolocation error handling: better error messages, explicit timeout, set world view on locateAndSetView failure. #61
API improvements
- Added MultiPolyline and MultiPolygon layers. #77
- Added LayerGroup and FeatureGroup layers for grouping other layers.
- Added TileLayer.Canvas for easy creation of canvas-based tile layers.
- Changed
Circle
to be zoom-dependent (with radius in meters); circle of a permanent size is now calledCircleMarker
. - Added
mouseover
andmouseout
events to map, markers and paths; added mapmousemove
event. - Added
setLatLngs
,spliceLatLngs
,addLatLng
,getLatLngs
methods to polylines and polygons. - Added
setLatLng
andsetRadius
methods toCircle
andCircleMarker
. - Improved
LatLngBounds contains
method to acceptLatLng
in addition toLatLngBounds
, the same forBounds contains
andPoint
- Improved
LatLngBounds
&Bounds
to allow their instantiation without arguments (by @snc). - Added TMS tile numbering support through
TileLayer
scheme: 'tms'
option (by @tmcw). - Added
TileLayer
noWrap
option to disable wrappingx
tile coordinate (by @jasondavies). - Added
opacity
option andsetOpacity
method toTileLayer
. - Added
setLatLng
andsetIcon
methods toMarker
. - Added
title
option toMarker
. - Added
maxZoom
argument tomap.locateAndSetView
method. - Added ability to pass Geolocation options to map
locate
andlocateAndSetView
methods (by @JasonSanford). - Improved
Popup
to accept HTML elements in addition to strings as its content.
Development workflow improvements
- Added
Makefile
for buildingleaflet.js
on non-Windows machines (by @tmcw). - Improved
debug/leaflet-include.js
script to allow using it outside ofdebug
folder (by @antonj). - Improved
L
definition to be compatible with CommonJS. #122
Bug fixes
General bugfixes
- Fixed a bug where zooming is broken if the map contains a polygon and you zoom to an area where it's not visible. #47
- Fixed a bug where closed polylines would not appear on the map.
- Fixed a bug where marker that was added, removed and then added again would not appear on the map. #66
- Fixed a bug where tile layer that was added, removed and then added again would not appear on the map.
- Fixed a bug where some tiles would not load when panning across the date line. #97
- Fixed a bug where map div with
position: absolute
is reset torelative
. #100 - Fixed a bug that caused an error when trying to add a marker without shadow in its icon.
- Fixed a bug where popup content would not update on
setContent
call. #94 - Fixed a bug where double click zoom wouldn't work if popup is opened on map click
- Fixed a bug with click propagation on popup close button. #99
- Fixed inability to remove ImageOverlay layer.
Browser bugfixes
- Fixed a bug where paths would not appear in IE8.
- Fixed a bug where there were occasional slowdowns before zoom animation in WebKit. #123
- Fixed incorrect zoom animation & popup styling in Opera 11.11.
- Fixed popup fade animation in Firefox and Opera.
- Fixed a bug where map isn't displayed in Firefox when there's an
img { max-width: 100% }
rule.
Mobile browsers bugfixes
- Fixed a bug that prevented panning on some Android 2.1 (and possibly older) devices. #84
- Disabled zoom animation on Android by default because it's buggy on some devices (will be enabled back when it's stable enough). #32
- Fixed a bug where map would occasionally break while multi-touch-zooming on iOS. #32
- Fixed a bug that prevented panning/clicking on Android 3 tablets. #121
- Fixed a bug that prevented panning/clicking on Opera Mobile. #138
- Fixed potentional memory leak on WebKit when removing tiles, thanks to @Scalar4eg. #107
0.1 (2011-05-13)
Initial Leaflet release.