update changelog and build

This commit is contained in:
Vladimir Agafonkin 2013-06-24 20:28:32 -04:00
parent a12bd9474f
commit 1d3ab22ca2
3 changed files with 92 additions and 36 deletions

View File

@ -18,6 +18,7 @@ An in-progress version being developed on the master branch.
* **Improved zoom control design** once more - cleaner, simpler, more accessible (mostly by [@jacobtoye](https://github.com/jacobtoye)). [#1313](https://github.com/Leaflet/Leaflet/issues/1313) * **Improved zoom control design** once more - cleaner, simpler, more accessible (mostly by [@jacobtoye](https://github.com/jacobtoye)). [#1313](https://github.com/Leaflet/Leaflet/issues/1313)
* Updated `Control.Layers` icon (designed by Volker K), added retina version and SVG source. [#1739](https://github.com/Leaflet/Leaflet/issues/1739) * Updated `Control.Layers` icon (designed by Volker K), added retina version and SVG source. [#1739](https://github.com/Leaflet/Leaflet/issues/1739)
* Added keyboard accessibility to markers (you can now tab to them and press enter for click behavior). [#1355](https://github.com/Leaflet/Leaflet/issues/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](https://github.com/mourner) with lots of fixes from [@danzel](https://github.com/danzel)). [#1140](https://github.com/Leaflet/Leaflet/issues/1140) [#1437](https://github.com/Leaflet/Leaflet/issues/1437) [#52](https://github.com/Leaflet/Leaflet/issues/52) * Improved `TileLayer` zoom animation to eliminate flickering in case one tile layer on top of another or when zooming several times quickly (by [@mourner](https://github.com/mourner) with lots of fixes from [@danzel](https://github.com/danzel)). [#1140](https://github.com/Leaflet/Leaflet/issues/1140) [#1437](https://github.com/Leaflet/Leaflet/issues/1437) [#52](https://github.com/Leaflet/Leaflet/issues/52)
* Subtly improved default popup styles * Subtly improved default popup styles
* Significantly improved mass layer removal performance (by [@jfgirard](https://github.com/jfgirard) with fixes from [@danzel](https://github.com/danzel)). [#1141](https://github.com/Leaflet/Leaflet/pull/1141) [#1514](https://github.com/Leaflet/Leaflet/pull/1514) * Significantly improved mass layer removal performance (by [@jfgirard](https://github.com/jfgirard) with fixes from [@danzel](https://github.com/danzel)). [#1141](https://github.com/Leaflet/Leaflet/pull/1141) [#1514](https://github.com/Leaflet/Leaflet/pull/1514)
@ -37,12 +38,12 @@ An in-progress version being developed on the master branch.
* Added `addOneTimeEventListener` method (aliased to `once`) to all events-enabled objects (by [@iirvine](https://github.com/iirvine)). [#473](https://github.com/Leaflet/Leaflet/issues/473) [#1596](https://github.com/Leaflet/Leaflet/issues/1596) * Added `addOneTimeEventListener` method (aliased to `once`) to all events-enabled objects (by [@iirvine](https://github.com/iirvine)). [#473](https://github.com/Leaflet/Leaflet/issues/473) [#1596](https://github.com/Leaflet/Leaflet/issues/1596)
* Added ability to pass coordinates as simple objects (`{lat: 50, lon: 30}` or `{lat: 50, lng: 30}`). [#1412](https://github.com/Leaflet/Leaflet/issues/1412) * Added ability to pass coordinates as simple objects (`{lat: 50, lon: 30}` or `{lat: 50, lng: 30}`). [#1412](https://github.com/Leaflet/Leaflet/issues/1412)
* Added `LatLngBounds` `getNorth`, `getEast`, `getSouth`, `getWest` methods (by [@yohanboniface](https://github.com/yohanboniface)). [#1318](https://github.com/Leaflet/Leaflet/issues/1318) * Added `LatLngBounds` `getNorth`, `getEast`, `getSouth`, `getWest` methods (by [@yohanboniface](https://github.com/yohanboniface)). [#1318](https://github.com/Leaflet/Leaflet/issues/1318)
* Added `AMD` support (Leaflet now registers itself as a `leaflet` AMD module). [#1364](https://github.com/Leaflet/Leaflet/issues/1364) * Added `AMD` support (Leaflet now registers itself as a `leaflet` AMD module) (with fixes from [@sheppard](https://github.com/sheppard)). [#1364](https://github.com/Leaflet/Leaflet/issues/1364) [#1778](https://github.com/Leaflet/Leaflet/issues/1778)
* Added `L.Util.trim` function (by [@kristerkari](https://github.com/kristerkari)). [#1607](https://github.com/Leaflet/Leaflet/pull/1607) * Added `L.Util.trim` function (by [@kristerkari](https://github.com/kristerkari)). [#1607](https://github.com/Leaflet/Leaflet/pull/1607)
##### Layers API improvements ##### Layers API improvements
* Added `toGeoJSON` method to various layer types, allowing you to **save your Leaflet layers as GeoJSON**. (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1462](https://github.com/Leaflet/Leaflet/issues/1462) [#712](https://github.com/Leaflet/Leaflet/issues/712) * Added `toGeoJSON` method to various layer types, allowing you to **save your Leaflet layers as GeoJSON**. (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1462](https://github.com/Leaflet/Leaflet/issues/1462) [#712](https://github.com/Leaflet/Leaflet/issues/712) [#1779](https://github.com/Leaflet/Leaflet/issues/1779)
* 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](https://github.com/robpvn) & [@danzel](https://github.com/danzel)). [#1726](https://github.com/Leaflet/Leaflet/issues/1726) [#561](https://github.com/Leaflet/Leaflet/issues/561) [#1753](https://github.com/Leaflet/Leaflet/issues/1753) [#1754](https://github.com/Leaflet/Leaflet/pull/1754) * 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](https://github.com/robpvn) & [@danzel](https://github.com/danzel)). [#1726](https://github.com/Leaflet/Leaflet/issues/1726) [#561](https://github.com/Leaflet/Leaflet/issues/561) [#1753](https://github.com/Leaflet/Leaflet/issues/1753) [#1754](https://github.com/Leaflet/Leaflet/pull/1754)
* Added `LayerGroup` `hasLayer` method (by [@rvlasveld](https://github.com/rvlasveld)). [#1282](https://github.com/Leaflet/Leaflet/issues/1282) [#1300](https://github.com/Leaflet/Leaflet/pull/1300) * Added `LayerGroup` `hasLayer` method (by [@rvlasveld](https://github.com/rvlasveld)). [#1282](https://github.com/Leaflet/Leaflet/issues/1282) [#1300](https://github.com/Leaflet/Leaflet/pull/1300)
* Added `LayerGroup` `getLayers` method (by [@tmcw](https://github.com/tmcw)). [#1469](https://github.com/Leaflet/Leaflet/pull/1469) * Added `LayerGroup` `getLayers` method (by [@tmcw](https://github.com/tmcw)). [#1469](https://github.com/Leaflet/Leaflet/pull/1469)
@ -61,10 +62,12 @@ An in-progress version being developed on the master branch.
* Added `Popup` `keepInView` option (thanks to [@lapo-luchini](https://github.com/lapo-luchini)) that prevents the popup from going off-screen while it's opened. [#1308](https://github.com/Leaflet/Leaflet/pull/1308) [#1052](https://github.com/Leaflet/Leaflet/issues/1052) * Added `Popup` `keepInView` option (thanks to [@lapo-luchini](https://github.com/lapo-luchini)) that prevents the popup from going off-screen while it's opened. [#1308](https://github.com/Leaflet/Leaflet/pull/1308) [#1052](https://github.com/Leaflet/Leaflet/issues/1052)
* Added `Marker` `togglePopup` method (by [@popox](https://github.com/popox)). [#1761](https://github.com/Leaflet/Leaflet/issues/1761) * Added `Marker` `togglePopup` method (by [@popox](https://github.com/popox)). [#1761](https://github.com/Leaflet/Leaflet/issues/1761)
* Added `Popup` `closeOnClick` option that overrides the same `Map` option for specific popups (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1669](https://github.com/Leaflet/Leaflet/issues/1669) * Added `Popup` `closeOnClick` option that overrides the same `Map` option for specific popups (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1669](https://github.com/Leaflet/Leaflet/issues/1669)
* Added `TileLayer.WMS` `crs` option to be able to use WMS of CRS other than the map CRS (by [@kengu](https://github.com/kengu)). [#942](https://github.com/Leaflet/Leaflet/issues/942) [#945](https://github.com/Leaflet/Leaflet/issues/945)
##### Map API improvements ##### 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](https://github.com/Leaflet/Leaflet/pull/1617) [#1616](https://github.com/Leaflet/Leaflet/issues/1616) [#340](https://github.com/Leaflet/Leaflet/issues/340) [#483](https://github.com/Leaflet/Leaflet/issues/483) [#1164](https://github.com/Leaflet/Leaflet/issues/1164) [#1420](https://github.com/Leaflet/Leaflet/issues/1420) * 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](https://github.com/Leaflet/Leaflet/pull/1617) [#1616](https://github.com/Leaflet/Leaflet/issues/1616) [#340](https://github.com/Leaflet/Leaflet/issues/340) [#483](https://github.com/Leaflet/Leaflet/issues/483) [#1164](https://github.com/Leaflet/Leaflet/issues/1164) [#1420](https://github.com/Leaflet/Leaflet/issues/1420)
* Improved `Map` `invalidateSize` to accept options object (`animate` and `pan`, the latter controls if it pans the map on size change)
* Improved `Map` `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). [#859](https://github.com/Leaflet/Leaflet/issues/859) * Improved `Map` `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). [#859](https://github.com/Leaflet/Leaflet/issues/859)
* Added `Map` `remove` method to properly destroy the map and clean up all events (by [@jfirebaugh](https://github.com/jfirebaugh) and [@mourner](https://github.com/mourner)). [#1434](https://github.com/Leaflet/Leaflet/issues/1434) [#1101](https://github.com/Leaflet/Leaflet/issues/1101) [#1621](https://github.com/Leaflet/Leaflet/issues/1621) * Added `Map` `remove` method to properly destroy the map and clean up all events (by [@jfirebaugh](https://github.com/jfirebaugh) and [@mourner](https://github.com/mourner)). [#1434](https://github.com/Leaflet/Leaflet/issues/1434) [#1101](https://github.com/Leaflet/Leaflet/issues/1101) [#1621](https://github.com/Leaflet/Leaflet/issues/1621)
* Added `Map` `zoomlevelschange` event that triggers when the current zoom range (min/max) changes (by [@moonlite](https://github.com/moonlite)). [#1376](https://github.com/Leaflet/Leaflet/pull/1376) * Added `Map` `zoomlevelschange` event that triggers when the current zoom range (min/max) changes (by [@moonlite](https://github.com/moonlite)). [#1376](https://github.com/Leaflet/Leaflet/pull/1376)
@ -80,7 +83,7 @@ An in-progress version being developed on the master branch.
##### Controls API improvements ##### Controls API improvements
* Added **generic toolbar classes** for reuse by plugin developers (used by zoom control). * Added **generic toolbar classes** for reuse by plugin developers (used by zoom control).
* Added `Control.Layers` `overlayadd` and `overlayremove` events (by [@calvinmetcalf](https://github.com/calvinmetcalf)). [#1286](https://github.com/Leaflet/Leaflet/issues/1286) * Added `Control.Layers` `baselayerchange`, `overlayadd` and `overlayremove` events (by [@calvinmetcalf](https://github.com/calvinmetcalf) and [@Xelio](https://github.com/Xelio)). [#1286](https://github.com/Leaflet/Leaflet/issues/1286) [#1634](https://github.com/Leaflet/Leaflet/issues/1634)
* Added `Control` `getContainer` method. [#1409](https://github.com/Leaflet/Leaflet/issues/1409) * Added `Control` `getContainer` method. [#1409](https://github.com/Leaflet/Leaflet/issues/1409)
#### Development workflow improvements #### Development workflow improvements
@ -96,6 +99,7 @@ An in-progress version being developed on the master branch.
* Fixed lots of issues with extent restriction by `Map` `maxBounds`. [#1491](https://github.com/Leaflet/Leaflet/issues/1491) [#1475](https://github.com/Leaflet/Leaflet/issues/1475) [#1194](https://github.com/Leaflet/Leaflet/issues/1194) [#900](https://github.com/Leaflet/Leaflet/issues/900) [#1333](https://github.com/Leaflet/Leaflet/issues/1333) * Fixed lots of issues with extent restriction by `Map` `maxBounds`. [#1491](https://github.com/Leaflet/Leaflet/issues/1491) [#1475](https://github.com/Leaflet/Leaflet/issues/1475) [#1194](https://github.com/Leaflet/Leaflet/issues/1194) [#900](https://github.com/Leaflet/Leaflet/issues/900) [#1333](https://github.com/Leaflet/Leaflet/issues/1333)
* Fixed occasional crashes by disabling zoom animation if changing zoom level by more than 4 levels.. [#1377](https://github.com/Leaflet/Leaflet/issues/1377) * Fixed occasional crashes by disabling zoom animation if changing zoom level by more than 4 levels.. [#1377](https://github.com/Leaflet/Leaflet/issues/1377)
* Fixed a bug with that caused stuttery keyboard panning in some cases (by [@tmcw](https://github.com/tmcw)). [#1710](https://github.com/Leaflet/Leaflet/issues/1710)
* Fixed a bug that caused unwanted scrolling of the page to the top of the map on focus. [#1228](https://github.com/Leaflet/Leaflet/issues/1228) [#1540](https://github.com/Leaflet/Leaflet/issues/1540) * Fixed a bug that caused unwanted scrolling of the page to the top of the map on focus. [#1228](https://github.com/Leaflet/Leaflet/issues/1228) [#1540](https://github.com/Leaflet/Leaflet/issues/1540)
* Fixed a bug where clicking on a marker with an open popup caused the popup to faded in again (by [@snkashis](https://github.com/snkashis)). [#506](https://github.com/Leaflet/Leaflet/issues/560) [#1386](https://github.com/Leaflet/Leaflet/pull/1386) * Fixed a bug where clicking on a marker with an open popup caused the popup to faded in again (by [@snkashis](https://github.com/snkashis)). [#506](https://github.com/Leaflet/Leaflet/issues/560) [#1386](https://github.com/Leaflet/Leaflet/pull/1386)
* Fixed a bug where zoom buttons disabled state didn't update on min/max zoom change (by [@snkashis](https://github.com/snkashis)). [#1372](https://github.com/Leaflet/Leaflet/pull/1372) [#1328](https://github.com/Leaflet/Leaflet/issues/1328) * Fixed a bug where zoom buttons disabled state didn't update on min/max zoom change (by [@snkashis](https://github.com/snkashis)). [#1372](https://github.com/Leaflet/Leaflet/pull/1372) [#1328](https://github.com/Leaflet/Leaflet/issues/1328)
@ -122,6 +126,7 @@ An in-progress version being developed on the master branch.
##### General API bugfixes ##### General API bugfixes
* Fixed compatibility with Browserify (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1572](https://github.com/Leaflet/Leaflet/pull/1572) * Fixed compatibility with Browserify (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1572](https://github.com/Leaflet/Leaflet/pull/1572)
* 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](https://github.com/Leaflet/Leaflet/issues/301)
* Fixed a bug where event listener still fired even if it was removed on the same event in other listener (by [@spamdaemon](https://github.com/spamdaemon)). [#1661](https://github.com/Leaflet/Leaflet/issues/1661) [#1654](https://github.com/Leaflet/Leaflet/issues/1654) * Fixed a bug where event listener still fired even if it was removed on the same event in other listener (by [@spamdaemon](https://github.com/spamdaemon)). [#1661](https://github.com/Leaflet/Leaflet/issues/1661) [#1654](https://github.com/Leaflet/Leaflet/issues/1654)
* Fixed a bug where `L.point` and `L.latLng` factories weren't passing `null` and `undefined` values through. * Fixed a bug where `L.point` and `L.latLng` factories weren't passing `null` and `undefined` values through.
* Fixed `DomEvent` `removeListener` function chaining (by [@pagameba](https://github.com/pagameba)). * Fixed `DomEvent` `removeListener` function chaining (by [@pagameba](https://github.com/pagameba)).
@ -129,6 +134,7 @@ An in-progress version being developed on the master branch.
* Fixed a bug where `Point` `equals` and `contains` methods didn't accept points in array form. * Fixed a bug where `Point` `equals` and `contains` methods didn't accept points in array form.
* Fixed a bug where `LatLngBounds` `extend` of an undefined object would cause an error (by [@korzhyk](https://github.com/korzhyk)). [#1688](https://github.com/Leaflet/Leaflet/issues/1688) * Fixed a bug where `LatLngBounds` `extend` of an undefined object would cause an error (by [@korzhyk](https://github.com/korzhyk)). [#1688](https://github.com/Leaflet/Leaflet/issues/1688)
* Fixed a bug where `Control.Attribution` `removeAttribution` of inexistant attribution corrupted the attribution text. [#1410](https://github.com/Leaflet/Leaflet/issues/1410) * Fixed a bug where `Control.Attribution` `removeAttribution` of inexistant attribution corrupted the attribution text. [#1410](https://github.com/Leaflet/Leaflet/issues/1410)
* Fixed a bug where `setView` on an invisible map caused an error (by [@jfire](https://github.com/jfire)). [#1707](https://github.com/Leaflet/Leaflet/issues/1707)
##### Layers API bugfixes ##### Layers API bugfixes
@ -149,6 +155,7 @@ An in-progress version being developed on the master branch.
* Fixed a bug where layer `onRemove` was still called even if it was never added (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1729](https://github.com/Leaflet/Leaflet/issues/1729) * Fixed a bug where layer `onRemove` was still called even if it was never added (by [@jfirebaugh](https://github.com/jfirebaugh)). [#1729](https://github.com/Leaflet/Leaflet/issues/1729)
* Fixed a bug where calling `setRadius` on a Canvas-powered `CircleMarker` would cause an infinite loop (by [@snkashis](https://github.com/snkashis)). [#1712](https://github.com/Leaflet/Leaflet/issues/1712) [#1713](https://github.com/Leaflet/Leaflet/issues/1713) [#1728](https://github.com/Leaflet/Leaflet/issues/1728) * Fixed a bug where calling `setRadius` on a Canvas-powered `CircleMarker` would cause an infinite loop (by [@snkashis](https://github.com/snkashis)). [#1712](https://github.com/Leaflet/Leaflet/issues/1712) [#1713](https://github.com/Leaflet/Leaflet/issues/1713) [#1728](https://github.com/Leaflet/Leaflet/issues/1728)
* Renamed `marker-icon@2x.png` to `marker-icon-2x.png` to fix compatibility with Google AppEngine. [#1552](https://github.com/Leaflet/Leaflet/issues/1552) [#1553](https://github.com/Leaflet/Leaflet/issues/1553) * Renamed `marker-icon@2x.png` to `marker-icon-2x.png` to fix compatibility with Google AppEngine. [#1552](https://github.com/Leaflet/Leaflet/issues/1552) [#1553](https://github.com/Leaflet/Leaflet/issues/1553)
* Fixed a bug where `popupclose` and `popupopen` events weren't fired for multipolygons and multipolylines (by [@tmcw](https://github.com/tmcw)). [#1681](https://github.com/Leaflet/Leaflet/issues/1681)
##### Map API bugfixes ##### Map API bugfixes

107
dist/leaflet-src.js vendored
View File

@ -15,7 +15,7 @@ if (typeof module === 'object' && typeof module.exports === 'object') {
// define Leaflet as an AMD module // define Leaflet as an AMD module
} else if (typeof define === 'function' && define.amd) { } else if (typeof define === 'function' && define.amd) {
define('leaflet', [], function () { return L; }); define(L);
} }
// define Leaflet as a global L variable, saving the original L to restore later if needed // define Leaflet as a global L variable, saving the original L to restore later if needed
@ -1519,11 +1519,10 @@ L.Map = L.Class.extend({
this.setView(L.latLng(options.center), options.zoom, {reset: true}); this.setView(L.latLng(options.center), options.zoom, {reset: true});
} }
this._initLayers(options.layers);
this._handlers = []; this._handlers = [];
this.callInitHooks(); this.callInitHooks();
this._initLayers(options.layers);
}, },
@ -2158,14 +2157,16 @@ L.Map = L.Class.extend({
}, },
_onMouseClick: function (e) { _onMouseClick: function (e) {
if (!this._loaded || (this.dragging && this.dragging.moved())) { return; } // jshint camelcase: false
if (!this._loaded || (this.dragging && this.dragging.moved()) || e._leaflet_stop) { return; }
this.fire('preclick'); this.fire('preclick');
this._fireMouseEvent(e); this._fireMouseEvent(e);
}, },
_fireMouseEvent: function (e) { _fireMouseEvent: function (e) {
if (!this._loaded) { return; } // jshint camelcase: false
if (!this._loaded || e._leaflet_stop) { return; }
var type = e.type; var type = e.type;
@ -2948,7 +2949,7 @@ L.TileLayer.WMS = L.TileLayer.extend({
for (var i in options) { for (var i in options) {
// all keys that are not TileLayer options go to WMS params // all keys that are not TileLayer options go to WMS params
if (!this.options.hasOwnProperty(i)) { if (!this.options.hasOwnProperty(i) && i !== 'crs') {
wmsParams[i] = options[i]; wmsParams[i] = options[i];
} }
} }
@ -2960,8 +2961,10 @@ L.TileLayer.WMS = L.TileLayer.extend({
onAdd: function (map) { onAdd: function (map) {
this._crs = this.options.crs || map.options.crs;
var projectionKey = parseFloat(this.wmsParams.version) >= 1.3 ? 'crs' : 'srs'; var projectionKey = parseFloat(this.wmsParams.version) >= 1.3 ? 'crs' : 'srs';
this.wmsParams[projectionKey] = map.options.crs.code; this.wmsParams[projectionKey] = this._crs.code;
L.TileLayer.prototype.onAdd.call(this, map); L.TileLayer.prototype.onAdd.call(this, map);
}, },
@ -2969,14 +2972,13 @@ L.TileLayer.WMS = L.TileLayer.extend({
getTileUrl: function (tilePoint, zoom) { // (Point, Number) -> String getTileUrl: function (tilePoint, zoom) { // (Point, Number) -> String
var map = this._map, var map = this._map,
crs = map.options.crs,
tileSize = this.options.tileSize, tileSize = this.options.tileSize,
nwPoint = tilePoint.multiplyBy(tileSize), nwPoint = tilePoint.multiplyBy(tileSize),
sePoint = nwPoint.add([tileSize, tileSize]), sePoint = nwPoint.add([tileSize, tileSize]),
nw = crs.project(map.unproject(nwPoint, zoom)), nw = this._crs.project(map.unproject(nwPoint, zoom)),
se = crs.project(map.unproject(sePoint, zoom)), se = this._crs.project(map.unproject(sePoint, zoom)),
bbox = [nw.x, se.y, se.x, nw.y].join(','), bbox = [nw.x, se.y, se.x, nw.y].join(','),
@ -3375,6 +3377,7 @@ L.Marker = L.Class.extend({
title: '', title: '',
clickable: true, clickable: true,
draggable: false, draggable: false,
keyboard: true,
zIndexOffset: 0, zIndexOffset: 0,
opacity: 1, opacity: 1,
riseOnHover: false, riseOnHover: false,
@ -3485,6 +3488,10 @@ L.Marker = L.Class.extend({
L.DomUtil.addClass(icon, classToAdd); L.DomUtil.addClass(icon, classToAdd);
if (options.keyboard) {
icon.tabIndex = '0';
}
this._icon = icon; this._icon = icon;
this._initInteraction(); this._initInteraction();
@ -3577,6 +3584,7 @@ L.Marker = L.Class.extend({
L.DomUtil.addClass(icon, 'leaflet-clickable'); L.DomUtil.addClass(icon, 'leaflet-clickable');
L.DomEvent.on(icon, 'click', this._onMouseClick, this); L.DomEvent.on(icon, 'click', this._onMouseClick, this);
L.DomEvent.on(icon, 'keypress', this._onKeyPress, this);
for (var i = 0; i < events.length; i++) { for (var i = 0; i < events.length; i++) {
L.DomEvent.on(icon, events[i], this._fireMouseEvent, this); L.DomEvent.on(icon, events[i], this._fireMouseEvent, this);
@ -3608,6 +3616,15 @@ L.Marker = L.Class.extend({
}); });
}, },
_onKeyPress: function (e) {
if (e.keyCode === 13) {
this.fire('click', {
originalEvent: e,
latlng: this._latlng
});
}
},
_fireMouseEvent: function (e) { _fireMouseEvent: function (e) {
this.fire(e.type, { this.fire(e.type, {
@ -3622,6 +3639,8 @@ L.Marker = L.Class.extend({
} }
if (e.type !== 'mousedown') { if (e.type !== 'mousedown') {
L.DomEvent.stopPropagation(e); L.DomEvent.stopPropagation(e);
} else {
L.DomEvent.preventDefault(e);
} }
}, },
@ -5904,7 +5923,7 @@ L.GeoJSON = L.FeatureGroup.extend({
if (options.filter && !options.filter(geojson)) { return; } if (options.filter && !options.filter(geojson)) { return; }
var layer = L.GeoJSON.geometryToLayer(geojson, options.pointToLayer, options.coordsToLatLng); var layer = L.GeoJSON.geometryToLayer(geojson, options.pointToLayer, options.coordsToLatLng);
layer.feature = geojson; layer.feature = L.GeoJSON.asFeature(geojson);
layer.defaultOptions = layer.options; layer.defaultOptions = layer.options;
this.resetStyle(layer); this.resetStyle(layer);
@ -6029,24 +6048,40 @@ L.extend(L.GeoJSON, {
} }
return coords; return coords;
},
getFeature: function (layer, newGeometry) {
return layer.feature ? L.extend({}, layer.feature, {geometry: newGeometry}) : L.GeoJSON.asFeature(newGeometry);
},
asFeature: function (geoJSON) {
if (geoJSON.type === 'Feature') {
return geoJSON;
}
return {
type: 'Feature',
properties: {},
geometry: geoJSON
};
} }
}); });
L.Marker.include({ L.Marker.include({
toGeoJSON: function () { toGeoJSON: function () {
return { return L.GeoJSON.getFeature(this, {
type: 'Point', type: 'Point',
coordinates: L.GeoJSON.latLngToCoords(this.getLatLng()) coordinates: L.GeoJSON.latLngToCoords(this.getLatLng())
}; });
} }
}); });
L.Polyline.include({ L.Polyline.include({
toGeoJSON: function () { toGeoJSON: function () {
return { return L.GeoJSON.getFeature(this, {
type: 'LineString', type: 'LineString',
coordinates: L.GeoJSON.latLngsToCoords(this.getLatLngs()) coordinates: L.GeoJSON.latLngsToCoords(this.getLatLngs())
}; });
} }
}); });
@ -6065,10 +6100,10 @@ L.Polygon.include({
} }
} }
return { return L.GeoJSON.getFeature(this, {
type: 'Polygon', type: 'Polygon',
coordinates: coords coordinates: coords
}; });
} }
}); });
@ -6079,13 +6114,13 @@ L.Polygon.include({
var coords = []; var coords = [];
this.eachLayer(function (layer) { this.eachLayer(function (layer) {
coords.push(layer.toGeoJSON().coordinates); coords.push(layer.toGeoJSON().geometry.coordinates);
}); });
return { return L.GeoJSON.getFeature(this, {
type: type, type: type,
coordinates: coords coordinates: coords
}; });
} }
}); });
} }
@ -6096,17 +6131,17 @@ L.Polygon.include({
L.LayerGroup.include({ L.LayerGroup.include({
toGeoJSON: function () { toGeoJSON: function () {
var geoms = []; var features = [];
this.eachLayer(function (layer) { this.eachLayer(function (layer) {
if (layer.toGeoJSON) { if (layer.toGeoJSON) {
geoms.push(layer.toGeoJSON()); features.push(L.GeoJSON.asFeature(layer.toGeoJSON()));
} }
}); });
return { return {
type: 'GeometryCollection', type: 'FeatureCollection',
geometries: geoms features: features
}; };
} }
}); });
@ -6223,7 +6258,6 @@ L.DomEvent = {
}, },
disableClickPropagation: function (el) { disableClickPropagation: function (el) {
var stop = L.DomEvent.stopPropagation; var stop = L.DomEvent.stopPropagation;
for (var i = L.Draggable.START.length - 1; i >= 0; i--) { for (var i = L.Draggable.START.length - 1; i >= 0; i--) {
@ -6231,7 +6265,7 @@ L.DomEvent = {
} }
return L.DomEvent return L.DomEvent
.addListener(el, 'click', stop) .addListener(el, 'click', L.DomEvent._fakeStop)
.addListener(el, 'dblclick', stop); .addListener(el, 'dblclick', stop);
}, },
@ -6273,6 +6307,12 @@ L.DomEvent = {
return delta; return delta;
}, },
_fakeStop: function stop(e) {
// fakes stopPropagation by setting a special event flag checked in Map mouse events handler
// jshint camelcase: false
e._leaflet_stop = true;
},
// check if element really left/entered the event target (for mouseenter/mouseleave) // check if element really left/entered the event target (for mouseenter/mouseleave)
_checkMouse: function (el, e) { _checkMouse: function (el, e) {
@ -6430,6 +6470,10 @@ L.Draggable = L.Class.extend({
L.DomEvent L.DomEvent
.on(document, L.Draggable.MOVE[e.type], this._onMove, this) .on(document, L.Draggable.MOVE[e.type], this._onMove, this)
.on(document, L.Draggable.END[e.type], this._onUp, this); .on(document, L.Draggable.END[e.type], this._onUp, this);
if (e.type === 'mousedown') {
L.DomEvent.on(document, 'mouseout', this._onUp, this);
}
}, },
_onMove: function (e) { _onMove: function (e) {
@ -6500,6 +6544,8 @@ L.Draggable = L.Class.extend({
.off(document, L.Draggable.END[i], this._onUp); .off(document, L.Draggable.END[i], this._onUp);
} }
L.DomEvent.off(document, 'mouseout', this._onUp);
if (this._moved) { if (this._moved) {
// ensure drag is not fired after dragend // ensure drag is not fired after dragend
L.Util.cancelAnimFrame(this._animRequest); L.Util.cancelAnimFrame(this._animRequest);
@ -7405,6 +7451,9 @@ L.Map.Keyboard = L.Handler.extend({
map = this._map; map = this._map;
if (key in this._panKeys) { if (key in this._panKeys) {
if (map._panAnim && map._panAnim._inProgress) { return; }
map.panBy(this._panKeys[key]); map.panBy(this._panKeys[key]);
if (map.options.maxBounds) { if (map.options.maxBounds) {
@ -8232,8 +8281,8 @@ L.PosAnimation = L.Class.extend({
if (L.Browser.any3d) { if (L.Browser.any3d) {
matches = style[L.DomUtil.TRANSFORM].match(this._transformRe); matches = style[L.DomUtil.TRANSFORM].match(this._transformRe);
left = parseFloat(matches[1]); left = matches ? parseFloat(matches[1]) : 0;
top = parseFloat(matches[2]); top = matches ? parseFloat(matches[2]) : 0;
} else { } else {
left = parseFloat(style.left); left = parseFloat(style.left);
top = parseFloat(style.top); top = parseFloat(style.top);

8
dist/leaflet.js vendored

File diff suppressed because one or more lines are too long