(all changes without author notice are by @mourner)
An in-progress version being developed on the master
branch.
L.Canvas
redraws on several scenarios (by @perliedman, #5250, also thanks to @manubb for investigation and PR).dblclick
events in Chrome 55 due to PointerEvent
s (by @IvanSanchez, #5185, #5248, #5268).L.SVG.VML
for IE8 (by @IvanSanchez, #5215).popupopen
event (by @hagai26, #5202).getBoundsZoom
return value on CRSs with a flipped axis (by @computerlove, #5204).errorTileUrl
of a L.TileLayer
returns 404 (by @IvanSanchez, #5177).L.Canvas
redraw areas to avoid artifacts during partial updates (by @Ernie23, #5148).isPopupOpen()
behaviour of L.Layer
when no popup is bound to a layer (by @gvangool, #5106).LatLngBounds.contains()
to allow for non-instantiated LatLng
objects (by @IvanSanchez, #5135).L.Control.Layers
when the collapse
option is false
(by @perliedman, #5131).WrapLatLngBounds
method to L.CRS
, to fix an issue with maxBounds
of GridLayer
s (by @IvanSanchez, #5185, also thanks to @DiogoMCampos for investigation).L.Map.getSize()
will now return 0
instead of NaN
in non-graphical environments (by @ughitsaaron, #5209).alt
attribute to the <img>
s of marker shadows (by @topicus, #5259).max-width
is already set (by @brunob, #5046).mouseover
events for same layer (by @perliedman, #5033).L.Canvas
vectors during a zoom animation (by @ghybs) #5011.FeatureCollection
s (by @IvanSanchez), #5045.minZoom
/maxZoom
late inizialization (by @IvanSanchez), #4916.mouseover
/mouseout
events on overlapping L.Canvas
layers (by @perliedman), #5090.L.Control.Layers.collapse()
on initially uncollapsed layer controls (by @perliedman), #5131.L.Tooltip
by rounding up pixel coordinates (by @ashmigelski), #5089.L.Canvas
(by @perliedman), #5100.sortLayers
option to L.Control.Layers
(by @IvanSanchez, #4711.bringToFront
and bringToBack
when using L.Canvas
, plus preventing other canvas glitches (by @perliedman), #5115.minNativeZoom
option to L.TileLayer
s. (by @bb-juliogarcia), #5088.L.Path
s by refactoring away event logic (by @IvanSanchez) #5054)].L.Marker
and L.Map
no longer have a separate file (by @mourner).zoomanimated
option for L.Popup
s (by @fnicollet) #4699bower.json
(by @anotherredward) #4865L.Icon
default path using CSS (by @IvanSanchez) #4605getScaleZoom
in some custom CRSs (by @theashyster) #4919L.Path
event handlers against race conditions (by @perliedman and @IvanSanchez) #4855 #4929 #4838L.GridLayer
s, wrap tileBounds
when noWrap
is false (by @fyeah) #4908L.Path
’s bringToFront()
behaviour in the Edge browser (by @nikolai-b) #4848getCenter()
when a L.Polygon
has no map and thus no CRS (by @snkashis) #4820_leaflet_id
to map containers to prevent error when removing a map twice (by @IvanSanchez) #4810L.Tooltip
offset
option now defaults to [0, 0]
(by @yohanboniface) #4773L.Tooltip
zoom animation (by @yohanboniface) #4744layer.bindTooltip
crashing when called before adding the layer to the map (by @yohanboniface) #4779L.Popup
autopaning (by @yohanboniface) #4768L.Tooltip
not being closed on touch when touching the map (by @yohanboniface) #4767popupopen
and popupclose
not being fired when clicking on path with an open popup (by @yohanboniface) #4788L.Handler.enable
/disable
return this
(by @yohanboniface) #4708size
option can now be initialised with a number (by @rheh) #4608classname
option to L.GridLayer
(by @jayvarner) #4553Map.addLayer
(by @nathancahill) #4504x
and y
properties (by @nathancahill) #4465updateWhenZooming
option to L.GridLayer
(by @IvanSanchez) #4462popup.options.offset
when computing popup offset (fix #4645) (by @yohanboniface) #4662L.Bounds
for “marking as prunable” and loading tiles (by @IvanSanchez) #4650L.Tooltip
class to display small tooltips on the map (by @yohanboniface) #3952GridLayer
’s outer edge snapping to vertical center of map (fix #4702) (by @yohanboniface) #4704pointer-events: visiblePainted
as fallback for IE <11 (by @perliedman) #4690abbr
in website (by @brunob) #4663L.DomUtil.create()
from automatically setting a CSS class name (by @MuellerMatthew) #4563Control.Layers._getLayer
(by @ValentinH) #4561getWheelDelta()
(by @IvanSanchez) #4538getBoundsZoom
with small size and padding (by @dianjin) #4532L.Control.Layers
in IE8 (by @jieter) #4509TileLayer
’s retina logic when zoomReverse
is enabled. (by @perliedman) #4503setMaxBounds
not resetting maxBounds
when passing null
argument (by @yohanboniface) #4494L.Control.removeLayer()
raising an error when trying to remove a layer not yet added (by @jieter) #4487L.Evented.listens()
on removed event handlers, #4474 (by @IvanSanchez) #4476markerZoomAnimation
event hooks (by @IvanSanchez) #4460L.Control.Layers.collapse
/expand
public methods (by @yohanboniface) #4370L.latLngBounds
factory return an empty bounds with no argument (by @yohanboniface) #4368Map.fitBounds
now raises an error if bounds are not valid (by @theotow) #4353L.Circle
(by @JrFolk) #4290NaN
circle radius (by @IvanSanchez) #4237L.Class.include()
& mergeOptions()
now return this
(by @IvanSanchez) #4246L.LatLng.equals
to L.CRS.equals
. (by @perliedman) #4074{-y}
in tile layer urls (by @jieter) #4337dashArray
path option in canvas (by @gommo) #4173navigator.pointerEnabled
(by @IvanSanchez) #4287L.Control.Layers
internally (by @jieter) #4227L.Browser.edge
(by @IvanSanchez) #4143L.DivIcon.bgPos
option to L.Point
(by @perliedman) #4090Map.fitBounds
(by @perliedman) #4377flyTo
(by @hyperknot) #4376L.CRS.Earth
. (by @perliedman) #4369setLineDash
. (by @perliedman) #4364Map.TouchZoom
(by @IvanSanchez) #4340this._times.length
undefined in Map.Drag.js
(by @LucasMouraDeOliveira) #4324L.Path
(by @elkami12) #4314L.Control.Layer
that is not on the map (by @errebenito) #4280Map.attributionControl
only set on addInitHook
(by @snkashis) #4263e.originalEvent
in DomUtil._filterclick
(by @IvanSanchez) #4256L.Draggable
(by @turban) #4250Map.stop
(by @IvanSanchez) #4229Map.fadeAnimation
and GridLayer.opacity
(by @IvanSanchez) #4228L.Browser.any3d
(by @IvanSanchez) #4212pxBounds
validity before using it (by @yohanboniface) #4191L.Circle
radius (by @IvanSanchez) #4133dblclick
instead of touch events (by @IvanSanchez) #4131L.Polyline
’s pixel bounds. (by @perliedman) #4114undefined
property (by @robertleeplummerjr) #4113tileunload
for all unloading of tiles (by @tcoats) #4099L.GridLayer.retainParent()
(by @jblarsen) #4094_enforcingBounds
. (by @perliedman) #4089L.Control.Layers
where calling map._size
instead of getSize()
(by @Brobin) #4063resetStyle
(by @yohanboniface) #4028maxZoom
not honoring 0 (by @simsibimsiwimsi) #4000L.GridLayer._updateLevels()
when out of min/max zoom (prevents IE8 exceptions) (by @IvanSanchez) #3999L.DomUtil.getPosition()
should return a fallback value (for VML in IE8) (by @IvanSanchez) #3998L.Marker
: init interaction regardless of new icon or not (by @celadevra) #3978interactive=false
not taken into account for canvas (by @yohanboniface) #3956Beta 2 fixes over 50 bugs that were reported by users trying out beta 1. The vast majority of changes are small fixes to problems that are triggered in very specific situations or conditions, a few API consolidation changes, and a few browser workarounds.
L.circle
now accepts radius
as an option (like L.circleMarker
) rather than a second argument (by @IvanSanchez)preclick
event during drag (by @yohanboniface) #3632L.ImageOverlay.setBounds()
and fixed image overlay initialization (by @fminuti) #3680mousedown
events (by @yohanboniface) #3682msPointer
events (by @IvanSanchez) #3684Geolocation.clearWatch()
#3707bringToFront
and bringToBack
to popups (by @danzel). #3908 #3307preventOutline
exceptions #3625contextmenu
behaviour when there are no event listeners (by @yohanboniface) #3638max-width
(by @davidjb) #3647mouseout
and mouseover
event bubbling (by @yohanboniface) #3648 #3797 #3708flyTo
animations when the map center doesn’t change (by @fminuti) #3663baselayerchange
event (by @yohanboniface) #3677L.Util.requestAnimFrame
definition (by @fminuti) #3703L.Circle.getBounds()
(by @knabar) #3776Rectangle.setBounds()
return value (by @IvanSanchez) e698f641af
maxZoom
is set (by @patrickarlt) #3721noWrap
option in L.GridLayer
(by @IvanSanchez) #3691The first beta of the huge, long-awaited Leaflet 1.0 release.
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 if your code breaks after upgrading.
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 performance, adding Canvas retina support, getting rid of ugly hacks and generally making the code much cleaner. Main PR #2290.
Renderer
layer (inherited by SVG/Canvas implementations) that handles renderer bounds and zoom animation.SVG
& Canvas
classes that now contain all renderer-specific code for vector layers and can be added as layers to the map.Path
, Polyline
, etc.) now don’t contain any renderer-specific code and instead can be passed a renderer layer to use as renderer
in options;MultiPolyline
and MultiPolygon
classes since multiple rings are now handled by Polyline
and Polygon
classes respectively. Layers with multiple rings now perform much better (since each is now physically a single path object instead of being a FeatureGroup
of layers).Polyline
and Polygon
getCenter
for getting centroids.Polyline
and Polygon
popup positioning when calling openPopup
.Polyline
/Polygon
getBounds
to be cached (so it works much faster).Circle
to inherit from CircleMarker
and not the other way.GeoJSON
resetStyle
to work properly in case style
option wasn’t set.moveend
when updating Canvas layers.Polyline
and Polygon
spliceLatLngs
method (just use setLatLngs
instead).Polygon
getLatLngs
to always return an array of rings (nested array) (by @yohanboniface). #2618 #3386 Leaflet/Leaflet#3279 #2648fillRule
option (by @bullgare). #2834L_PREFER_CANVAS
global switch and added Map
preferCanvas
option instead (by @yohanboniface). #3623All 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 (main PR #2266):
Layer
class which all layers added to a map should inherit from.add
and remove
events to all layers.remove
method to layers and controls (marker.remove()
is now equivalent to map.removeLayer(marker)
).pane
option to all layers that can be changed (e.g. you can set pane: 'overlayPane'
to a tile layer).map
createPane
method for custom panes. #1742objectsPane
, all panes are on the same level now.shadowPane
option to markers as well.getEvents
method to all layers that returns an {event: listener, ...}
hash; layers now manage its listeners automatically without having to do this in onAdd
/onRemove
.togglePopup
, setPopupContent
, getPopup
, isPopupOpen
methods to all layers. #2279 #2292FeatureGroup
getBounds
to work correctly when containing circle markers.Map
tilelayersload
event.Popup
open
and close
events in favor of add
and remove
for consistency.Map.js
to Layer.js
.FeatureGroup
bindPopup
to accept a function for generating popup content, significantly improving memory footprint when adding popups to a huge number of layers (by @patrickarlt). #3109 #3059ImageOverlay
interactivity (mouse events, etc.) (by @snkashis). #3009 #1727ImageOverlay
getBounds
(by @brunob). #2848clickable
option to interactive
(by @AndriiHeonia). #2838 #2499nonBubblingEvents
option to layers (by @yohanboniface). #3605 #3307 #3604In addition, layer events implementation was rewritten to use event delegation, significantly improving add/remove performance and memory footprint. #3032 #46
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):
These changes make implementing custom grid-like layers for Leaflet much easier.
TileLayer
logic into the new GridLayer
class (which TileLayer
now inherits, extending it with logic specific to tile servers).TileLayer.Canvas
in favor of the much more flexible and powerful GridLayer
.TileLayer
to work transparently and completely depent on the CRS used; removed the need for TileLayer
hacks when using custom projections.url
property in tileload
and tileloadstart
events (get it through tile.src
).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.
CRS.Earth
which serves as a base for all Earth-based CRS (EPSG3857
etc.). #2345Projection
bounds
property that defines bounds for different projections (Mercator
, etc.) in projected coordinates (by @perliedman).CRS
wrapLat
and wrapLng
properties which define whether the world wraps on a given axis and in what range. Set as [-180, 180]
for EPSG:3857
, EPSG:4326
, EPSG:3395
by default.CRS
and Map
wrapLatLng
(the latter depends on the chosen CRS).CRS
infinite
property that disables boundaries (the world can go on infinitely in any direction), default for CRS.Simple
.CRS
getProjectedBounds
and Map
getPixelWorldBounds
methods that returns world bounds in projected coordinates depending on zoom (derived from Projection
bounds
) (by @perliedman).CRS
unproject
method that converts coordinates in CRS-dependent units into LatLng
coordinates (by @sowelie).Map
distance(latlng1, latlng2)
method that takes CRS into account and works with flat projections. #2345 #1442Circle
to be approximated with an ellipse in Earth-based projections. #2345EPSG:4326
to have correct tile pyramid (2x1 tiles at root).Projection.SphericalMercator
to project to meter units (by @calvinmetcalf).Map
worldCopyJump
option to work for other projections.Circle
to work with flat projections. #2345 #1465ImageOverlay
not working properly in some non-standard projections. #3011Animation code in Leaflet had undergone a major rewrite (main PR: #2382), bringing improvements such as:
map.flyTo
) for zooming to a particular place in a curve (simultaneously zooming and panning)map.setZoom(12.45)
and it just works.zoom
event in addition to viewreset
for frame-by-frame zoom animations. #3278LatLng
creation performance (8x).FeatureGroup
(and correspondingly GeoJSON
) layer adding and events performance (about 10x) by implementing a much better event propagation mechanism. #2311Evented
off
performance by about 2 times.DomUtil
off
to require context
attribute if you remove a listener that was previously added with a particular context.DomUtil.getViewportOffset
method as it is no longer necessary.DomUtil
getTranslateString
and getScaleString
methods.DomUtil
documentIsLtr
method.LatLng
RAD_TO_DEG
, DEG_TO_RAD
and MAX_MARGIN
constants.Util.limitExecByInterval
to Util.throttle
.Evented
class that now many Leaflet classes inherit from (instead of mixing in events methods in each class), while keeping the old includes: L.Mixin.Events
syntax available. #2310Class
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{r}
variable to TileLayer
url
for adding "@2x"
prefix on Retina-enabled devices (by @urbaniak). #2296Point
ceil
method (by @perliedman).Util.wrapNum
method for wrapping a number to lie in a certain range.L.bind
to use native Function
bind
on modern browsers and prepend real arguments to bound ones.LatLng
equals
second argument maxMargin
.DomUtil
setClass
and getClass
methods.Marker
move
event to include oldLatlng
(by @danzel). #2412Marker
mousemove
event (by @bullgare). #2798DomEvent
on
/off
to accept space-separated events and object literals ({type: fn}
).DomUtil
toFront
and toBack
methods.Evented
listens
as a shortcut to hasEventListeners
.L.map
option touchZoom
(by @mtmail). #2527getElement
method to all layers that returns an associated DOM element.LatLng
clone
method (by @yohanboniface). #3390Map
setMinZoom
and setMaxZoom
methods (by @nathancahill). #3383 #3380originalEvent
to Map
and Marker
drag
and move
event data (by @yohanboniface). #3264Popup
autoClose
option (by @jfirebaugh). #3018 #2716 #1853Control.Zoom
enable
and disable
methods. #3172L.PolyUtil.clipPolygon
that controls rounding (by @aparshin). #2926 #2917Map
wheelDebounceTime
option (by @AndriiHeonia). #2836 #2501TileLayer.WMS
uppercase
option (now false
by default) (by @kdeloach). #2831 #1751ImageOverlay
alt
option (by @francis-liberty). #2767 #2564L.Util.extend
performance (by @fab1an). #2746Map
stop
method for stopping panning or flyTo
animation.Map
maxBoundsViscosity
option that controls how much the map resits dragging out of max bounds (set to 1
for a hard limit) (by @IvanSanchez). #2224 #3510 #1673Bounds
and LatLngBounds
overlaps
method (by @IvanSanchez). #2981 #3508ImageOverlay
crossOrigin
option (by @patrickarlt). #3594 #2621DomUtil
on
to make it possible to add the same listener to the same element for multiple contexts.ImageOverlay
mercator distortion on lower zoom levels.popupopen
and popupclose
events when manually creating a popup object and passing it to bindPopup
. #2354Map
panInsideBounds
to accept array-form bounds (by @RLRR). #3489LatLng
wrap
to not drop altitude (by @IvanSanchez). #3420setMaxBounds
several times in a row (by @IvanSanchez). #3410 #3320Map
locate
bug that could cause some unexpected effects (by @sindre). Leaflet/Leaflet#3404Polygon
getCenter
when all points in the same pixel (by @yohanboniface). #3372Polyline
getCenter
when the line is very small (by @yohanboniface). #3371azerty
keyboards. #3362Map
panBy
not always returning this
(by @Trufi). #3303Polygon
toGeoJSON
exporting a MultiPolygon
in some cases (by @yohanboniface). #2977TileLayer.WMS
passing all options as WMS params. #2972map.fitBounds(map.getBounds())
zoom out sometimes. #2957setIcon
(by @jeffsmale90). #2578TileLayer
when maxNativeZoom = 0
. #3004FeatureGroup
setStyle
not affecting ImageOverlay
opacity
(by @opie). #3008 #2246Map
worldCopyJump
option is enabled (by @flemenach). #3038 #2624getMaxZoom
sometimes returned wrong result inside a Control.Layers
baselayerchange
event (by @CloudNiner). #3048 #2318Map
getSize
race condition where it could return a wrong result (by @kshepard). #3052 #3031L.latLng
factory to accept altitude
as a third argument too (by @lonelyelk). #3070.L.latLng
factory to not throw error on empty array input (by @lonelyelk). #3080 #3079Map
locate
not to mutate the given options object (by @tmcw). #3173Marker
setIcon
to not reset popup anchor offset (by @bullgare). #2872zoom
in Map
options and then set center (by @AndriiHeonia). #2849 #1871TileLayer
setUrl
where loading
event didn’t fire properly (by @bennlich). #2802 #2675 #2827Marker
setIcon
(by @jfgodoy). #2811LatLng
distanceTo
to not return NaN
on equal locations. #2705TileLayer
maxNativeZoom
didn’t work properly with bounds
option set (by @mlegenhausen). #2725 #2704map.remove()
(by @IvanSanchez). #3514 #2718jake build
) to report gzipped library size.src/images/logo.svg
.package.json
(by @bclinkinbeard). #2432Note tha we skipped 0.7.6 version for which we accidentally published a broken build to NPM.
minZoom
or maxZoom
options (by @ivansanchez) #3778maxNativeZoom
were not checking bounds properly (by @jlaxon) #3415bindPopup(popup)
(by @Eschon) #3675Map.fitBounds
padding (by @bsstoner). #2489dblclick
and contextmenu
events (by @ivansanchez) #3482fillRule
option (by @w8r) #3477lineCap
and lineJoin
options (by @northerneyes) #3156setView
(or similar methods) several times in succession could freeze the map. #2521 #2236 #2485Control.Layers
wasn’t properly removed (by @jack-kerouac). #2569TileLayer
load
event not to fire properly. #2510remove
event when removed (by @adimitrov). #2486maxNativeZoom
option didn’t work with TMS tile layers (by @perliedman). #2321 #2314L.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 #1968Map
invalidateSize
could lead to unexpected results when called before map initialization (by @Zverik). #2250 #2249FeatureGroup
containing other group overwrote original e.layer
value in mouse events (by @gumballhead). #2253 #2252CircleMarker
setLatLngs
didn’t return this
(by @radicalbiscuit). #2206maxBounds
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 #1908Map
setView
zoom
argument optional. #2056maxZoom
option to Map
fitBounds
. #2101Map
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 #2072distance
property to Map
and Marker
dragend
events. #2158 #872timestamp
to Map
locationfound
event. #584Map
invalidateSize
to call moveend
immediately unless given debounceMoveend: true
option (by @jfirebaugh). #2181TileLayer
maxNativeZoom
option that allows displaying tile layers on zoom levels above their maximum by upscaling tiles. #1802 #1798TileLayer
tileloadstart
event (by @tmcw). #2142 #2140TileLayer
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). #2160Marker
add
event (by @tohaocean). #1942Marker
getPopup
method (by @scottharvey). #618 #1197Marker
alt
option for adding alt
text to markers (by @jimmytidey). #2112Path
className
option for adding custom class names to vector layers.Path
lineCap
and lineJoin
options (by @palewire). #1843 #1863 #1881GeoJSON
(by @kapouer). #2075Polygon
setLatLngs
to also accept holes (by @aparshin). #2095 #1518GeoJSON
3D format support and optional altitude
argument to LatLng
constructor (by @Starefossen). #1822MultiPolygon
and MultiPolyline
openPopup
method. #2046Popup
update
method. #1959Popup
autoPanPaddingTopLeft
and autoPanPaddingBottomRight
options (by @albburtsev). #1972 #1588Popup
getContent
method. #2100Popup
getLatLng
method (by @AndreyGeonya). #2097ImageOverlay
setUrl
and getAttribution
methods and attribution
option (by @stsydow). #1957 #1958L.Util.template
performance (affects L.TileLayer
) by introducing cached template compilation (by @calvinmetcalf). #1969 #1968 #1554CRS
getSize
for getting the world size in pixels (by @perliedman). #2160leaflet-drag-target
CSS class to an element under cursor when dragging for more flexible customization. #2164 #1902L.DomUtil
addClass
, removeClass
, hasClass
methods performance and fixed it to work with SVG elements. #2164leaflet.css
and removed leaflet.ie.css
, so no need for IE conditional comment when including Leaflet now. #2159leaflet-oldie
CSS class to map container in IE7-8 for easier styling. #2159jake
command to run tests before building the source. #2151package.json
to unminified version for NPM/Browserify (by @icetan). #2109worldCopyJump: true
option (by @fastrde). #1904 #1831 #1982L.DomUtil.getMousePosition
would throw an error if container argument not provided (by @scooterw). #1826 #1928 #1926maxBounds
behaving weirdly on panning inertia out of bounds. #2168EPSG:3395
projection were shifted (by @aparshin). #2020box-sizing: border-box
.maxBounds
(by @kapouer and @mourner). #2187 #1946 #2081 #2168 #1908+
no longer zoomed the map on FF 22+ (by @fastrde). #1943 #1981Map
remove
throwed an error in IE6-8. #2015isArray
didn’t work in rare cases in IE9. #2077Map
getCenter
returned old result after map container size changed (by @jfirebaugh). #1940 #1919Map
invalidateSize
rounding issues when changing map size by an odd pixel amount (by @russelldavis). #1931Map
removeLayer
didn’t return this
in a corner case (by @jfirebaugh).Map
setZoom
before setView
would throw an error. #1449Popup
setLatLng
unnecessarily reset content and updated layout; works much faster now. #2167toGeoJSON
of layers originated from GeoJSON GeometryCollection and MultiPoint didn’t work properly (wasn’t round-tripped). #1956GeoJSON
dependencies in build configuration that could lead to a broken custom build in some situations (by @alubchuk). #1909CircleMarker
popup placement wasn’t updated after calling setLatLng
(by @snkashis). #1921 #1927Marker
setIcon
(by @snkashis). #1874 #1891FeatureGroup
would break when using non-evented children layers (by @tmcw). #2032 #1962CircleMarker
getRadius
would always return null
. #2016 #2017TileLayer.WMS
didn’t work with WMS 1.3 & EPSG4326 projection (by @Bobboya). #1897FeatureGroup
events e.layer
was sometimes empty in old IE. #1938L.latLngBounds
didn’t accept simple object LatLng
form (by @Gnurfos). #2025 #1915L.Util.tempalate
wouldn’t work with double quotes in the string (by @jieter). #1968 #2121 #2120fitBounds
and setMaxBounds
could freeze the browser in some situations. #1895 1866ImageOverlay
(by @jfirebaugh). #1821layerremove
and layeradd
were fired before the corresponding action finishes (by @jfirebaugh). #1846worldCopyJump: true
breaking the map on small zoom levels (by @danzel). #1831Marker
shadow didn’t animate on zoom after using setIcon
. #1768GeoJSON
ignored non-feature geometries passed in an array. #1840Map
minZoom
and maxZoom
didn’t always override values derived from the added tile layers. 1848TileLayer.Canvas
wasn’t immediately redrawn when redraw
is called (by @tofferrosen). #1797 #1817FeatureGroup
still fired layerremove
event on removeLayer
even if the given layer wan’t present in the group (by (by @danzel)). #1847 #1858Marker
setOpacity
wasn’t returning the marker (by @freepius44). #1851leaflet-bar
elements.setMaxBounds
(by @davidjb). #1834MultiPolyline
and MultiPolygon
getLatLngs
method. #1839dist
folder) were removed from the repo and are now done automatically on each commit for master
and stable
branches by Travis CI. The download links are on the Leafet download page.Object.prototype
(luckily it’s a thing of the past nowadays).Map
invalidateSize
no longer fires move
and moveend
events if the map size didn’t change. #1819Control.Layers
icon (designed by Volker Kinkelin), added retina version and SVG source. #1739TileLayer
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 #52map.attributionControl.setPrefix('')
if you need.Marker
popups to close on marker click if opened (by @popox). #1761toGeoJSON
method to various layer types, allowing you to save your Leaflet layers as GeoJSON. (by @jfirebaugh). #1462 #712 #1779GeoJSON
coordsToLatLng
option for dealing with GeoJSON that has non-WGS84 coords (thanks to @moonlite). #888 #886Marker
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 #1754latlng
property to Marker
mouse event data. #1613LayerGroup
hasLayer
method (by @rvlasveld). #1282 #1300LayerGroup
getLayers
method (by @tmcw). #1469LayerGroup
getLayer
method (by @gumballhead). #1650LayerGroup
removeLayer
method to also accept layer id
(by @gumballhead). #1642Path
pointerEvents
option for setting pointer-events on SVG-powered vector layers (by @inpursuit). #1053Polygon
to filter out last point if it’s equal to the first one (to fix GeoJSON polygon issues) (by @snkashis). #1153 #1135clickable: false
to allow mouse events to pass through to objects underneath (by @snkashis). #1384 #1281L.Util.template
(and correspondingly url-related TileLayer
options) to support functions for data values (by @olegsmith). #1554TileLayer
getContainer
method (by @tmcw). #1433TileLayer.Canvas
redraw
method chaining (by @jieter). #1287TileLayer.WMS
crs
option to be able to use WMS of CRS other than the map CRS (by @kengu). #942 #945popupopen
and popupclose
events to various layers (by @Koc). #738Popup
keepInView
option (thanks to @lapo-luchini) that prevents the popup from going off-screen while it’s opened. #1308 #1052Marker
togglePopup
method (by @popox). #1761Popup
closeOnClick
option that overrides the same Map
option for specific popups (by @jfirebaugh). #1669Marker
and Path
bindPopup
method to also accept Popup
objects (by @snkashis). #1385 #1208 #1402Marker
setPopupContent
method (by @snkashis). #1373Map
(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 #1420Map
fitBounds
method to accept padding
(or paddingTopLeft
and paddingBottomRight
) options, allowing you to zoom to an area with a certain padding in pixels (usually left for controls). #859Map
invalidateSize
to accept options object (animate
and pan
, the latter controls if it pans the map on size change). (by @jacobtoye and @mourner). #1766 #1767Map
setZoomAround
method for zooming while keeping a certain point fixed (used by scroll and double-click zooming). #1157Map
remove
method to properly destroy the map and clean up all events, and added corresponding unload
event (by @jfirebaugh and @mourner). #1434 #1101 #1621Map
tap
handler that now contains all mobile hacks for enabling quick taps and long holds and tapTolerance
option specifying the number of pixels you can shift your finger for click to still fire.Map
zoomAnimationThreshold
for setting the max zoom difference with which zoom animation can occur. #1377Map
openPopup
method to also accept (content, latlng)
signature as a shortcut.Map
closePopup
method to optionally accept a popup object to close. #1641Map
stopLocate
method to abort resetting map view if calling locate
with setView
option. #747Map
to throw exception if the specified container id is not found (by @tmcw). #1574Map
locationfound
event to pass all location data (heading, speed, etc.). #984 #584 #987 #1028Map
resize
event. #1564Map
zoomlevelschange
event that triggers when the current zoom range (min/max) changes (by @moonlite). #1376Map
baselayerchange
, overlayadd
and overlayremove
events fired by Control.Layers
(by @calvinmetcalf and @Xelio). #1286 #1634Control
getContainer
method. #1409cleanAllEventListeners
method (aliased to off
without arguments) to all events-enabled objects (by @iirvine). #1599addOneTimeEventListener
method (aliased to once
) to all events-enabled objects (by @iirvine). #473 #1596{lat: 50, lon: 30}
or {lat: 50, lng: 30}
). #1412LatLngBounds
getNorth
, getEast
, getSouth
, getWest
methods (by @yohanboniface). #1318AMD
support (Leaflet now registers itself as a leaflet
AMD module) (with fixes from @sheppard). #1364 #1778L.Util.trim
function (by @kristerkari). #1607Map
maxBounds
. #1491 #1475 #1194 #900 #1333contextmenu
events on popups falling through to map (by @snkashis). #1730 #1732404
tile loading errors when browsing the map off the world bounds.TileLayer
opacity didn’t work in IE 7-8 (by @javisantana & @danzel). #1084 #1396 #1371L.point
and L.latLng
factories weren’t passing null
and undefined
values through.DomEvent
removeListener
function chaining (by @pagameba).removeEventListener
would throw an error if no events are registered on the object (by @tjoekbezoer). #1632 #1631Point
equals
and contains
methods didn’t accept points in array form.LatLngBounds
extend
of an undefined object would cause an error (by @korzhyk). #1688Control.Attribution
removeAttribution
of inexistant attribution corrupted the attribution text. #1410setView
on an invisible map caused an error (by @jfire). #1707TileLayer.WMS
param values weren’t escaped in URLs (by @yohanboniface). #1317TileLayer.WMS
tileSize
option was ignored (by @brianhatchl). #1080Polyline
constructor could overwrite the source array (by @snkashis and @danzel). #1439 #1092 #1246 #1426TileLayer
to prevent incorrect subdomain in case of negative tile coordinates (by @malexeev). #1532DivIcon
html
option to accept 0
as a value (by @stuporglue). #1633mousemove
in certain conditions. #1615TileLayer
bounds
(by @ansis). #1618TileLayer
load
event wouldn’t always fire correctly. #1565TileLayer.WMS
compatibility with some old servers that only accepted request parameters in uppercase. #1751L.Icon.Default.imagePath
detection in some cases. #1657onRemove
was still called even if it was never added (by @jfirebaugh). #1729setRadius
on a Canvas-powered CircleMarker
would cause an infinite loop (by @snkashis). #1712 #1713 #1728marker-icon@2x.png
to marker-icon-2x.png
to fix compatibility with Google AppEngine. #1552 #1553popupclose
and popupopen
events weren’t fired for multipolygons and multipolylines (by @tmcw). #1681Map
fitBounds
wouldn’t work correctly with large bounds (thanks to @MaZderMind). #1069Map
hasLayer
wasn’t handling null
objects (by @rvlasveld). #1282 #1302Map
moveend
fired before dragend
on drag (by @oslek). #1374Map
movestart
event on inertia start (by @oslek). #1374Map
moveend
fired repeatedly on window resize even if the actual map size didn’t change (by @oslek). #1374Map
moveend
sometimes wasn’t fired after drag (particularly often when dragging with a trackpad).Map
load
event listener. #962Map
autopanstart
event back (it was removed occasionally in previous version). #1375Map
maxBounds
(by @jec006). #1749 #1750GeoJSON
not accepting arrays of FeatureCollection
(by @snkashis). #1299 #1298CirleMarker
setRadius
not working if called before adding the layer to the map (by @danzel). #1342 #1297Be sure to read through these changes to avoid any issues when upgrading from older versions:
LatLng
wrapping/clamping of coordinates (-180, -90
to 180, 90
), wrapping moved to an explicit method (LatLng
wrap
).Map
worldCopyJump
option by default (jumping back to the original world copy when panning out of it). Enable it explicitly if you need it.Icon
iconRetinaUrl
and shadowRetinaUrl
options) (by @danzel). #1048 #1174L.Transition
with a much better and simpler L.PosAnimation
.Class
addInitHook
method for adding constructor hooks to any classes (great extension point for plugin authors). #1123Map
whenReady
method (by @jfirebaugh). #1063delta
argument to Map
zoomIn
and zoomOut
(1 by default).isValid
method to LatLngBounds
and Bounds
(by @domoritz). #972Point
equals
method.Bounds
getSize
method.Path
unbindPopup
and closePopup
methods.Path
add
and remove
event.Marker
riseOnHover
and riseOffset
options (for bringing markers to front on hover, disabled by default) (by jacobtoye). #914 #920Marker
move
and remove
events.Marker
contextmenu
event. #223Popup
zoomAnimation
option (useful to disable when displaying flash content inside popups #999).FeatureGroup
layeradd
and layerremove
events (by @jacobtoye). #1122Control.Layers
baselayerchange
event (by @jfirebaugh). #1064Control.Layers
to support HTML in layer names (by @aparshin). #1055 #1099CRS.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), see debug/map/simple-proj.html
for an example.Browser
ua
, gecko
, opera
properties (no longer needed).L.extend
, L.bind
, L.stamp
, L.setOptions
shortcuts for corresponding L.Util
methods.L.Util.isArray
function (by @oslek). #1279mouseover
and mouseout
events to canvas-based vector layers (by @snkashis). #1403Map
eachLayer
to iterate over all layers added to the map (by @jfirebaugh). #1457TileLayer
bounds
option to limit tile loading to a specific region (by @adimitrov). #991panBy
wouldn’t round the offset values (so it was possible to make the map blurry with it). #1085TileLayer
bringToBack
didn’t work properly in some cases (by @danzel). #963 #959Map
load
event happened too late (after moveend
, etc.) (by @jfirebaugh). #1027Circle
getBounds
to return correct bounds and work without adding the circle to a map. #1068Popup
on viewreset
throwed an error (by fnicollet and @danzel). #1098 #1094TileLayer.Canvas
drawTile
didn’t receive tile zoom level in arguments.GeoJSON
resetStyle
would not fully reset a layer to its default style. #1112latLngBounds
factory with coordinates as string values. #933Marker
setIcon
, setZIndexOffset
, update
methods. #1176FeatureGroup
bindPopup
didn’t take options into account.CircleMarker
setStyle
didn’t take radius
into account (by @fdlk). #1012 #1013layer
event property on click (by @snkashis). #1215 #1243TileLayer.WMS
didn’t work correctly if the base URL contained query parameters (by @snkashis). #973 #1231GeoJSON
features with GeometryCollection
didn’t pass properties to pointToLayer
function (by @calvinmetcalf). #1097FeatureGroup
eachLayer
chaining. #1452TileLayer
bringToFront/Back()
throwed an error in IE6-8. #1168-
key not working in Firefox 15+ (thanks to @mattesCZ). #869GeoJSON
setStyle
to also accept function (like the corresponding option).GeoJSON
resetStyle(layer)
, useful for resetting hover state.feature
property to layers created with GeoJSON
(containing the GeoJSON feature data).FeatureGroup
bringToFront
and bringToBack
methods (so that they would work for multipolys).animate
argument to Map
invalidateSize
(by @ajbeaven). #857Path
bringToFront
and bringToBack
didn’t return this
.FeatureGroup
removeLayer
would unbind popups of removed layers even if the popups were not put by the group (affected Leaflet.markercluster plugin) (by @danzel). #861TileLayer
detectRetina
option (by @sxua). #854Leaflet 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):
LatLng
, LatLngBounds
, Point
and Bounds
values in an array form (e.g. map.panTo([lat, lng])
will be the same as map.panTo(new L.LatLng(lat, lng))
)addTo
method to all layer classes, e.g. marker.addTo(map)
is equivalent to map.addLayer(marker)
new
keyword, named the same as classes but starting with a lowercase letter, e.g. L.map('map')
is the same as new L.Map('map')
TileLayer
detectRetina
option (false
by default) that makes tiles show in a higher resolution on iOS retina displays (by @Mithgol). #586GeoJSON API was improved to be simpler and more flexible (example). The changes are not backwards-compatible, so be sure to update your old code.
style
option for styling vector layers, passed either as an object or as a function (to style vector layers according to GeoJSON properties).filter
option to leave out features that don’t correspond to a certain criteria (e.g. based on properties).onEachFeature
option to execute certain code on each feature layer based on its properties (binding popups, etc).pointToLayer
function signature to provide geojson
in addition to latlng
when creating point features for more flexibility.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).
Icon
properties to options, changed constructor signature to Icon(options)
.L.Icon.Default
class (which extends from L.Icon
).Icon
className
option to assign a custom class to an icon.Icon
shadowAnchor
option to set the anchor of the shadow.Icon
options except iconUrl
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.setPosition
and getPosition
to all controls, as well as ability to pass certain position as an option when creating a control.L.Control.Position.TOP_LEFT
) with light strings ('topleft'
, 'bottomright'
, etc.)TileLayer
constructor to interpolate URL template values from options (removed third urlParams
argument).TileLayer
scheme: 'tms'
option to tms: true
.Map
locateAndSetView
method (use locate
with setView: true
option)minWidth
and maxWidth
options to be applied to content element, not the whole popup.prefix
argument to options
in Control.Attribution
constructor.L.VERSION
to L.version
.on
and off
methods to also accept (eventHash[, context])
, as well as multiple space-separated events (by @Guiswa). #770off
to remove all listeners of the event if no function was specified (by @Guiswa). #770 #691TileLayer
setZIndex
method for controlling the order of tile layers (thanks to @mattcurrie). #837Control.Layers
autoZIndex
option (on by default) to preserve the order of tile layers when switching.TileLayer
redraw
method for re-requesting tiles (by @greeninfo). #719TileLayer
setUrl
method for dynamically changing the tile URL template.bringToFront
and bringToBack
methods to TileLayer
, ImageOverlay
and vector layers. #185 #505TileLayer
loading
event that fires when its tiles start to load (thanks to @lapinos03). #177TileLayer.WMS
setParams
method for setting WMS parameters at runtime (by @greeninfo). #719TileLayer.WMS
subdomain support ({s}
in the url) (by @greeninfo). #735originalEvent
property to MouseEvent
(by @k4). #521containerPoint
property to MouseEvent
. #413contextmenu
event to vector layers (by @ErrorProne). #500LayerGroup
eachLayer
method for iterating over its members.FeatureGroup
mousemove
and contextmenu
events (by @jacobtoye). #816DomEvent
methods.on
and off
aliases for DomEvent
addListener
and removeListener
methods.L_NO_TOUCH
global variable switch (set it before Leaflet inclusion) which disables touch detection, helpful for desktop apps built using QT. #572dashArray
option to vector layers for making dashed strokes (by jacobtoye). #821 #165Circle
getBounds
method. #440Circle
getLatLng
and getRadius
methods (by @Guiswa). #655openPopup
method to all vector layers. #246redraw
method to vector layers (useful if you manipulate their LatLng
points directly).Marker
opacity
option and setOpacity
method.Marker
update
method. #392Marker
openPopup
not to raise an error if it doesn’t have a popup. #507ImageOverlay
opacity
option and setOpacity
method. #438Popup
maxHeight
option that makes content inside the popup scrolled if it doesn’t fit the specified max height.Popup
openOn(map)
method (similar to Map
openPopup
).Map
getContainer
method (by @Guiswa). #654Map
containerPointToLatLng
and latLngToContainerPoint
methods. #474Map
addHandler
method.Map
mouseup
and autopanstart
events.LatLngBounds
pad
method that returns bounds extended by a percentage (by @jacobtoye). #492position: fixed
container (by @chx007). #602mousedown
listener. #834TileLayer
setOpacity
wouldn’t work when setting it back to 1.setStyle({stroke: false})
wouldn’t remove stroke and the same for fill. #441Marker
bindPopup
method wouldn’t take offset
option into account.TileLayer
load
event wasn’t fired if some tile didn’t load (by @lapinos03 and @cfis) #682GeoJSON
layer. #685GeoJSON
clearLayer
(by @runderwood). #617Control
setPosition
wasn’t always working correctly (by @ericmmartinez). #657Util.bind
sometimes losing arguments (by @johtso). #588drag
event was sometimes fired after dragend
. #555TileLayer
load
event was firing only once (by @lapinos03 and shintonik). #742 #177FeatureGroup
popup events where not cleaned up after removing a layer from it (by @danzel). #775DomUtil.removeClass
didn’t remove trailing spaces (by @jieter). #784moveend
listener.LayerGroup
addLayer
wouldn’t check if a layer has already been added (by @danzel). 798Control.Layers
didn’t work on IE7. #652mousemove
events on click in Chrome (by @stsydow). #757setStyle
would break the map. #641ImageOverlay
wouldn’t stretch properly on zoom on Android 2. #651clearLayers
for vector layers on a Canvas backend (e.g. on Android 2) would take unreasonable amount of time. #785setLatLngs
and similar methods on vector layers on a Canvas backend would not update the layers immediately. #732Control.Layers
) for convenient layer switching.map.addLayer(layer, true)
) (useful for switching base tile layers).Map
zoomstart
event (thanks to @Fabiz). #377Map
locate
method, added ability to watch location continuously and more options. #212inside
to Map
getBoundsZoom
method that allows you to get appropriate zoom for the view to fit inside the given bounds.hasLayer
method to Map
.Marker
zIndexOffset
option to be able to set certain markers below/above others. #65urlParams
third optional argument to TileLayer
constructor for convenience: an object with properties that will be evaluated in the URL template.TileLayer
continuousWorld
option to disable tile coordinates checking/wrapping.TileLayer
tileunload
event fired when tile gets removed after panning (by @CodeJosch). #256TileLayer
zoomOffset
option useful for non-256px tiles (by @msaspence).TileLayer
zoomReverse
option to reverse zoom numbering (by @Majiir). #406TileLayer.Canvas
redraw
method (by @mortenbekditlevsen). #459Polyline
closestLayerPoint
method that’s can be useful for interaction features (by @anru). #186setLatLngs
method to MultiPolyline
and MultiPolygon
(by @anru). #194getBounds
method to Polyline
and Polygon
(by @JasonSanford). #253getBounds
method to FeatureGroup
(by @JasonSanford). #557FeatureGroup
setStyle
method (also inherited by MultiPolyline
and MultiPolygon
). #353FeatureGroup
invoke
method to call a particular method on all layers of the group with the given arguments.ImageOverlay
load
event. #213minWidth
option to Popup
(by @marphi). #214LatLng
constructor to be more tolerant (and throw descriptive error if latitude or longitude can’t be interpreted as a number). #136LatLng
distanceTo
method (great circle distance) (by @mortenbekditlevsen). #462LatLngBounds
toBBoxString
method for convenience (by @JasonSanford). #263LatLngBounds
intersects(otherBounds)
method (thanks to @pagameba). #350LatLngBounds
extend
method to accept other LatLngBounds
in addition to LatLng
(by @JasonSanford). #553Bounds
intersects(otherBounds)
method. #461L.Util.template
method for simple string template evaluation.DomUtil.removeClass
method (by @anru).Klass.superclass
instead of this.superclass
(by @anru). #179Map
boxzoomstart
and boxzoomend
events (by @zedd45). #554Popup
contentupdate
event (by @mehmeta). #548shiftDragZoom
map option/property renamed to boxZoom
.mouseEventToLatLng
method (bringed back in 0.4).Circle
was rendered with incorrect radius (didn’t take projection exagerration into account). #331Map
getBounds
would work incorrectly on a date line cross. #295GeoJSON
pointToLayer
option wouldn’t work in a GeometryCollection
. #391Circle
was rendered with incorrect radius (didn’t take projection exaggeration into account). #331Marker
setIcon
was not working properly (by @marphi). #218 #311Marker
setLatLng
was not working if it’s set before adding the marker to a map. #222Marker
setLatLng
(by @tjarratt). #272closePopup
option (by @jgerigmeyer).Bounds
contains
method (by @anru). #180Polygon
with new L.Polygon()
would raise an error.movestart
event would fire after zoom animation.setPrefix
. #195TileLayer
load
event wouldn’t fire in some edge cases (by @dravnic).movestart
didn’t fire on panning animation.EPSG:3395
CRS (by @Savvkin). #358setView
or panTo
to the current center. #231TileLayer.Canvas
.TileLayer.WMS
layer).EPSG:3857
, EPSG:4326
and EPSG:3395
out of the box (through crs
option in Map
). Thanks to @Miroff & @Komzpa for great advice and explanation regarding this.requestAnimationFrame
. #130Circle
to be zoom-dependent (with radius in meters); circle of a permanent size is now called CircleMarker
.mouseover
and mouseout
events to map, markers and paths; added map mousemove
event.setLatLngs
, spliceLatLngs
, addLatLng
, getLatLngs
methods to polylines and polygons.setLatLng
and setRadius
methods to Circle
and CircleMarker
.LatLngBounds contains
method to accept LatLng
in addition to LatLngBounds
, the same for Bounds contains
and Point
LatLngBounds
& Bounds
to allow their instantiation without arguments (by @snc).TileLayer
scheme: 'tms'
option (by @tmcw).TileLayer
noWrap
option to disable wrapping x
tile coordinate (by @jasondavies).opacity
option and setOpacity
method to TileLayer
.setLatLng
and setIcon
methods to Marker
.title
option to Marker
.maxZoom
argument to map.locateAndSetView
method.locate
and locateAndSetView
methods (by @JasonSanford).Popup
to accept HTML elements in addition to strings as its content.Makefile
for building leaflet.js
on non-Windows machines (by @tmcw).debug/leaflet-include.js
script to allow using it outside of debug
folder (by @antonj).L
definition to be compatible with CommonJS. #122position: absolute
is reset to relative
. #100setContent
call. #94img { max-width: 100% }
rule.Initial Leaflet release.