* Add sourceTarget and propagatedFrom to events
Also documents events' target, sourceTarget, propagatedFrom
and layer properties.
Fixes#4510.
* Use propagatedFrom, which is equivalent of the original code
* propagetedFrom -> propagatedFrom
* Util.formatNum default to 6
Changed Util.formaNum default to 6 decimails.
Solved 0 decimals bug.
Added tests.
Can be useful for PR #5444
* Changed documentation
Changed documentation to 6 instead of 5
* [LayerGroup] use eachLayer method instead of for...in
* [LayerGroup] use eachLayer method in getLayers method
* [LayerGroup] use eachLayer method in onAdd & onRemove methods
* [LayerGroup] invoke method fix
- use `eachLayer` method instead of for...in
- add unit test for `invoke` method
* revert invoke method change
* Check if the map has a layer after layers removal, not before.
* fix wrong layer to add
* do symetric code with removedLayers and addedLayers
* add unit test for repeated layers
* Docs(Marker): explain checks for re-using icon element
when the marker is modified with an icon of the same type (i.e. an image icon with an image icon, or a DivIcon with a DivIcon), or checks for NOT re-using the icon element when modifying with an icon of a different type (i.e. an image icon with a DivIcon, or the reverse).
* Revert "Div icon accept node element as option (#5517)"
This reverts commit ba7bfb5011.
Conflicts:
spec/suites/layer/marker/MarkerSpec.js
* Don't turn enter keypress into clicks on map
But still preserve functionality to open marker's popup through
enter keypress when focused.
Fixes#5499.
* Clean code
Thanks @egoroof
* Change name of keypress handler to _onKeyPress
* Add unit test
* Add precision parameter to all toGeoJSON functions
* Replace usage of toPrecision with Utils.formatNum
* Always default to six decimal places
* Fix docs
* Allow precision of 0
* Added option to allow DOM elements inside a DIV icon
* Removed white line
* Adapted so that the dom element can be passed with the html option
* Update DivIcon.js
Changed documentation to state HTMLElement
* Feat(Bounds): add getTopLeft & getBottomRight methods
as suggested in #5475, for consistency with `LatLngBounds` methods which already provide methods for the 4 possible corners.
Also include the docstrings.
* Docs(Bounds): add comments to identify corners
in BoundsSpec.
* Test(Bounds): add tests for existing corner methods
namely getBottomLeft and getTopRight.
Checked that expecting different values make the tests fail.
* Test(Bounds): add spec for 2 new corner methods
namely getTopLeft and getBottomRight.
Closes#5475 together with previous PR #5487.
* Refactor(Bounds): return this.min(max) instead of new Point
as TopLeft corner is tha same as this.min (BottomRight same as this.max).
* Docs(Bounds): add links to this.min(max)
to make it clearer that these methods are just shorthands to already available properties.
Furthermore, it implies that they output those properties directly, making a clue for the app developer that if he/she wants to modify them, they should be cloned before doing so in order to prevent unintentional behaviour.
* Fix(#5328): Layers Control scrollable even if collapsed: false
the `expand()` method was called only when expanding the Layers Control through user action.
In the case of option `collapsed: false`, no event listener is attached (no user action expected to expand), therefore the control height is no longer adjusted compared to map container's height, whereas the only time it is done is at initialization, when the control is not yet inserted into the DOM, hence it does not have an actual height to check against.
Therefore added a hook on `addTo()` in order to run `expand()` AFTER the control has been insterted into the DOM.
The same issue happens when later adding more base layers / overlays to the Layers Control: it not collapsed, we should run again the height check (e.g. through the `expand()` method) to make sure we make it scrollable if necessary.
Therefore called `expand()` after each `_addLayer()`.
Actually checking first if the control is on map and if option `collapsed: false` in order to prevent calling `expand()` for nothing.
* Test(ControlLayers): 2 tests for collapsed: false being scrollable
(for issue #5328).
CAUTION: unlike most other tests, had to actually insert the map container into the DOM (i.e. `document.body`) for these tests to be useful, otherwise the height remains at 0.
This may lead to memory leak and tests hanging if done on too many tests (see Leaflet.markercluster tests issue, e.g. https://github.com/Leaflet/Leaflet.markercluster/pull/577)
* Add index.js files to subdirectories/namespace
This allows to streamline the import/export in the main file.
* Fix tests by switching to karma-rollup-plugin
* Add some tests for #5293
* Fix enabling marker dragging while markers aren't on the map by removing the dragging object when not on the map.
This is a change of behavior (.dragging is only defined when a marker is on the map).
* Docs for dragging change
* Create new bounds from projected coordinates rather than subtract in getBoundsZoom to avoid negative scale. Fixes#5195
* Fix unit test mocks
Apparently, mocking `project()` instead of `latLngToPoint()` magically works.
* Expected zoomlevel is 9, not 7
* Adds initial tests for L.Layer#popup
* Fixes Layer.isPopupOpen when no popup is bound
This fixes uncaught exception when checking whether a popup isOpen(),
when the layer has no popup bound to it.