* 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 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.
* Ensure zoom is within span when adding a layer with min/maxzoom, fixes#4915.
* Add tests written by @theashyster
* Add tests to verify map's zoom is actually adjusted to layer's min/max
Bug when using map option `preferCanvas: true` (canvas renderer for paths) and removing then adding back a vector within the same animation frame (typically in the same sequence, as done by Leaflet.markercluster at `"zoomend"` event, to remove layers and clusters outside visible bounds).
This commit clears the `_removed` flag from paths when they are added to the canvas.
Also added corresponding test suites.
- default offset is now [0, 0]
- both offset.x and offset.y are always honoured
- positive x always move the tooltip on the right
- positive y always move the tooltip on the bottom