Commit Graph

456 Commits

Author SHA1 Message Date
Martin Palmér
1d8cc53408 #5921 Remove touch based click tolerance (#5922) 2017-11-17 14:36:23 +01:00
iH8
abc3bf3027 Set _tilezoom to undefined instead of null (#5888)
* Set _tilezoom to undefined instead of null

Set _tilezoom to undefined instead of null

Fix for #5871 https://github.com/Leaflet/Leaflet/issues/5871

* add test
2017-11-13 14:27:52 +01:00
Per Liedman
c5cbbf8174 Clean up and document event propagation properties (#5880)
* 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
2017-10-27 16:18:12 +02:00
Per Liedman
d9846d106b Round pan offset towards zero (#5858)
* Add Point.trunc/_trunc

* Truncate pan offset instead of flooring

Fixes #5821
2017-10-26 15:35:35 +03:00
Andrew
f83b5347f5 skipIfNotTouch instead of overriding Browser.touch (#5869) 2017-10-26 15:34:31 +03:00
Andrew
7e5cbceaa5 add icon popupAnchor option test for nonPhantom browsers (#5865) 2017-10-23 15:29:28 +02:00
Per Liedman
a9742e0d4b Round circle radius in renderer instead of layer
Makes bounds calculation more precise and zoom level independant.
Fixes #4582.
2017-10-20 14:51:48 +02:00
Andrew
b54c2d4adf Fix TileLayer flyTo test (#5843)
* fix TileLayer flyTo test

* fix linter errors
2017-10-16 09:58:25 +03:00
Andrew
d76e5d0372 fix GridLayer flyTo test (#5846) 2017-10-16 09:57:56 +03:00
Fabrizio
d9655a1e9a Change Util.formatNum default to 6 decimals (#5492)
* 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
2017-10-02 18:36:59 +02:00
Andrew
3e3f9e89c4 [LayerGroup] Use eachLayer for iterations over layers (#5809)
* [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
2017-09-30 16:58:10 +03:00
Michael Siadak
2a324b0b94 Add tileerror tests to GridLayer spec (#5805) 2017-09-29 17:04:48 +03:00
Vladimir Agafonkin
88dd22cfe8 upgrade deps, fix indenting (#5743) 2017-08-31 08:58:42 +02:00
Michael Fenwick
0e36b948cd Feature: optionally allow popups to not close on pressing Esc (#5730)
* add test for disabled popup ESC key functionality

* add closeOnEscapeKey default option for popup

* add ESC key condition to prevent map.closePopup

* fix variable indentation

* revert unnecessary mapPopup variable back to map._popup

* add 4 spaces of indentation to variables
2017-08-28 16:11:54 +02:00
Alessandro
5228a62a1c feat(Marker.Drag): autoPan implementation (#5651)
* feat(Marker.Drag): autoPan implementation

* Adjust autoPanSpeed to 10

* Add tests for marker drag
2017-08-09 14:18:13 +02:00
Per Liedman
54ce147f3d Throw if argument to addLayer is not actually a layer (#5689)
Fixes #5225.
2017-08-06 08:36:10 +02:00
Javier Jimenez Shaw
922593addb When a layer is repeated in Control.Layers, behavior is not consistent. (#5672)
* 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
2017-07-31 09:20:40 +02:00
Yohan Boniface
b675753422 Make L.LineUtil._flat public as L.LineUtil.isFlat (#5667)
Also, keep retrocompat for both L.LineUtil._flat and
L.Polyline._flat (<1.1).
2017-07-29 23:47:17 +02:00
Per Liedman
0a6c500e58 Add test for extending L namespace 2017-07-27 11:03:52 +03:00
Vladimir Agafonkin
957f05da23 fix non-extendable objects regression of 1.1.0
Closes #5650 until we figure out a less hacky solution.
2017-07-27 11:03:51 +03:00
jelhan
7a73e1d140 Fix(DomEvent): DomEvent.off should return this (#5601)
Was broken by 14c5f1602c.
2017-07-03 10:47:11 +02:00
ghybs
d6fc47d70e Fix(DivIcon): revert #5517 to avoid appending a single node instead of generating content (#5574)
* 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
2017-06-25 14:11:57 +02:00
Per Liedman
a3ec8047b3 Add className option for ImageOverlay (#5555) 2017-06-22 16:25:15 +02:00
Per Liedman
b23d83f464 Don't turn enter keypress into clicks on map (#5507)
* 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
2017-06-02 11:18:46 +02:00
Matt Grande
1120c46ed9 Add precision parameter to all toGeoJSON functions (#5444)
* 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
2017-05-31 14:06:58 +02:00
MGMsystems
ba7bfb5011 Div icon accept node element as option (#5517)
* 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
2017-05-22 09:57:21 +02:00
Iván Sánchez Ortega
873d4cab31 Handle edge case of empty bounds on _getBoundsCenterZoom (#5157)
* Handle edge case of empty bounds on _getBoundsCenterZoom

* Unit test for map._getBoundsCenterZoom
2017-05-11 22:33:46 +02:00
ghybs
f677f9c6d2 Feat(Bounds): add new methods for 2 missing corners (#5488)
* 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.
2017-05-11 22:24:15 +02:00
Iván Sánchez Ortega
7e1740ecdf Better sanity checks for avoiding loading infinite tiles (#5479)
* Sanity check to prevent loading tiles when bounds are `Infinity`

* Make linter happy

* Better sanity checks for avoiding loading infinite tiles

* typo
2017-04-25 15:00:47 +02:00
Dave Leaver
27263b7afa Control.Layers: Only add layer events to layers when we are on the map. Fixes #5421 (#5422) 2017-03-28 23:10:29 +02:00
Tom Salisbury
96cfdd3a3d Added z-index support to ImageOverlay (#5418) 2017-03-28 10:54:24 +02:00
Tom Salisbury
8278ed393d Added error event to ImageOverlay layer and added tests for the new (#5416)
event and existing error handling. Also added missing
documentation for the load event.
2017-03-28 08:54:26 +02:00
Per Liedman
c18ac11efb Include L.Mixin.Events again; add deprecation notice (#5365)
Close #5358
2017-03-07 09:53:24 +01:00
Lewis Christie
0ed260c847 fix invalid geoJSON produced by nested LayerGroups (#5359) 2017-03-02 13:21:56 +01:00
ghybs
9e4f79d1e5 Fix(#5328): Layers Control can now become scrollable even if collapsed: false (#5348)
* 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)
2017-02-21 14:33:01 +01:00
Iván Sánchez Ortega
f57b5bf7ee Couple tests for Map.Keyboard.disable() 2017-02-14 13:15:50 +01:00
Iván Sánchez Ortega
c856c6090f Do not stop keypress on escape if no popup is open 2017-02-14 13:15:50 +01:00
Joachim Kuebart
1010451a66 Pull min/maxNativeZoom from TileLayer into GridLayer, as per #5316. (#5319)
* Pull min/maxNativeZoom from TileLayer into GridLayer, as per #5316.

* Add a couple unit tests for GridLayer's maxNativeZoom
2017-02-09 10:33:43 +01:00
Miguel Andrade
ad75456fa5 add margin to LatLngBounds.equals method (#5071)
* add margin to LatLngBounds equals method

* add tests
2017-02-02 16:55:30 +01:00
Iván Sánchez Ortega
ddc3a9ca61 Fix max/min calculation for getBoundsZoom (fixes #5136) (#5137)
* Fix max/min calculation for getBoundsZoom (fixes #5136)

* Added test for inside param of L.Map.getBoundsZoom()
2017-02-02 16:21:10 +01:00
Dave Leaver
5603a87c70 Remove marker.dragging when not on the map (#5295)
* 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
2017-02-02 10:14:39 +01:00
Vladimir Agafonkin
703ae02aa8 ES6 modules & Rollup (#4989)
* WIP ES6 modules & rollup

* WIP ES6 modules & rollup 2

* WIP ES6 modules & rollup 3

* WIP ES6 modules Browser

* WIP ES6 module fixes

* WIP ES6 modules: simpler browser exports

* WIP ES6: refactor CRS/Projection modules, CRS obj -> CRS.Base

* get rid of unnecessary index.js

* WIP ES6 modules, dom events and stuff

* Make linter happy, rollup to dist/

* revert to CRS namespace/class for now

* WIP rollup: export more stuff

* export controls

* rollup: export Layer

* rollup: export DomEvent

* rollup: export more layer types

* rollup: export Popup/Tooltip

* WIP: ES6-ify marker, icon, domutil, draggable.

* ES6-ify gridlayer, tilelayer.

* ES6-ify: Tweak imports-exports, code is now runnable!!

* ES6-ify: Fix scope in some DomUtils

* ES6-ify: Path, fix Popup

* ES6-ify: Lint & cleanup

* ES6-ify map handlers, more linting

* ES6-ify: Icon.Default namespacing

* ES6-ify: Renderers, CircleMarker

* ES6-ify: Circle, Polyline, LineUtil

* ES6-ify: Polygon, Rectangle, LineUtil, PolyUtil, linting

* ES6-ify: SVG.VML

* ES6-ify: DomEvent.Pointer, DomEvent.DoubleTap

* ES6-ify: Linting, make Karma play nice with Rollup

* ES6-ify: More work on fixing bits breaking some unit tests.

* ES6-ify: rollup the version number, fiddled with build scripts

* ES6-ify: Fiddle with test scripts

* ES6-ify: cleanup (refs to global L, imports from (DOM)Util), prevent cyclic loop on Map imports

* ES6-ify: More cleanup of (DOM)Util/Browser/DomEvent imports

* ES6ify: Use rollup's "legacy" option for ES3 (IE8) builds

* ES6-ify: Clean up build scripts, fix CONTRIBUTING.md instructions

* Typo

* ES6-ify: minor fixes and lefovers after rebasing on top of 1.0.2

* ES6-ify: upgrade to rollup 0.38 for proper IE8 builds, fix L.SVG.VML

* Make linter happy.

* ES6: Fixing typos and sxrew-ups after big rebase

* Fix symlink for debugging scripts

* ES6: Cleanup old build scripts

* ES6-ify: Update build system to include git rev in L.version

* ES6-ify: re-enable unit tests replacing L.Path with L.Polyline

* Export Path

* ES6ify: cleanup old banner file

* ES6-ify: whitespace in var declarations

* ES6-ify: Export toTransformation as L.transformation

* ES6-ify: cleanup L.transform exports

* ES6-ify: "import Util" in Transformation and SVG.VML
2017-01-30 11:35:16 +01:00
Markus
3ac37c29a4 Add L.transformation factory, allow creation from array (#5282)
* added transformation getter

* fixed lint, added editorconfig

* added CRS.Simple transformation values again

* removed editorconfig
2017-01-30 09:43:50 +01:00
Iván Sánchez Ortega
059a722b5b Implement wrapLatLngBounds (to fix #5149) (#5166)
* Implement wrapLatLngBounds (to fix #5149)

* Unit tests for wrapLatLngBounds
2017-01-13 16:39:01 +01:00
Iván Sánchez Ortega
b8b7281ee8 Added unit test for #5202 2016-12-21 14:49:47 +01:00
Marvin Bredal Lillehaug
884463bb09 Avoid getBoundsZoom return Infinity when using CRS with flipped axis (#5204)
* 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
2016-12-19 12:40:22 +01:00
Gert Van Gool
9d6e6fcdf4 Fixes Layer.isPopupOpen when no popup is bound (#5106)
* 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.
2016-11-29 10:33:54 +01:00
Iván Sánchez Ortega
633182a836 Sanity check in LatLngBounds.contains (fixes #5132) (#5135) 2016-11-24 09:36:33 +01:00
Per Liedman
2253672051 Only collapse layer control if collapsed: true (#5131)
Close #5126
2016-11-23 10:49:59 +01:00
Julio Garcia
d303a7b681 Adding Unit Tests for minNativeZoom and maxNativeZoom 2016-11-18 15:45:23 +01:00