Commit Graph

425 Commits

Author SHA1 Message Date
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
Iván Sánchez Ortega
4e979514c3 Add a 'sortLayers' option to L.Control.Layers (#4711)
* Add a 'sortLayers' option to L.Control.Layers

* Add a sortFunction option to L.Control.Layers

* Fix default sort function; modify test
2016-11-17 12:52:29 +01:00
Yohan Boniface
88d107ca96 Merge pull request #5087 from Leaflet/layers-collapse-alt
Always create L.Control.Layers as collapsed; expand if collapse option not set
2016-11-11 16:15:49 +01:00
Per Liedman
a656a0b9ec Add unit test 2016-11-11 15:54:05 +01:00
Iván Sánchez Ortega
8c22c4e385 Ensure zoom is within span when adding a layer with min/maxzoom, fixes #4915 (#4916)
* 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
2016-11-11 10:46:31 +01:00
Iván Sánchez Ortega
fd78560036 L.GeoJSON.asFeature should pass through FeatureCollections (#5049)
* L.GeoJSON.asFeature should pass through FeatureCollections

* Add unit test to verify FeatureCollection toGeoJSON
2016-11-10 13:53:38 +01:00
ghybs
34dca3cfd9 Fix #5011 (canvas remove+add) (#5024)
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.
2016-10-20 15:50:15 +03:00
Vladimir Agafonkin
fd8c2599ef fix icon url warnings in tests 2016-09-27 17:58:08 +03:00
Yohan Boniface
e28f7ae984 Do not fail when closing an interactive tooltip not yet added to the map (#4937) 2016-09-26 16:40:51 +03:00
Andris Nolendorfs
62fdf6f642 Fix handling of NaN in getScaleZoom (#4914)
* Fixed an issue when crs.zoom returns NaN in getScaleZoom

* Small documentation fixes
2016-09-15 09:46:53 +02:00
Iván Sánchez Ortega
63fd4edc76 wrap tileBounds if noWrap is false by @fyeah (#4908) 2016-09-12 16:59:21 +02:00
Per Liedman
ed1a612e6f Make paths insensitive to the order of its map's moveend handlers (#4855)
* Make Paths always update after renderer updates

Close #4851

* Add test

* Add docs for update event

* Remove listener when layer is removed
2016-08-31 17:58:46 +03:00
Per Liedman
017d29c4eb Just store array of listeners, count is no longer needed. (#4842)
* Just store array of listeners, count is no longer needed.

* Remove unused code
2016-08-25 17:23:58 +02:00
Yohan Boniface
7927708b40 Allow to create and open a tooltip without source (fix #4827) (#4836) 2016-08-25 15:29:20 +02:00
Per Liedman
cee8edeaf2 Fix listener removal even if an event is firing
Close #4840.
2016-08-25 15:20:51 +02:00
Per Liedman
59c6bb201c Use spies as listeners 2016-08-24 09:52:29 +02:00
Per Liedman
0c6dc2ce1e Make event firing reentrant
Close #4833
2016-08-24 09:26:53 +02:00
Iván Sánchez Ortega
e9957cfa02 Detect L.Icon.Default.imagePath using CSS. #4604, #3696, #4579 (#4605)
* CSS-based paths for L.Icon.Default. #4604, #3696, #4579

* Unit tests for default icons

* Make CSS icon path detection IE8-friendly

* Backwards compatibility for L.Icon.Default.imagePath override.

* Don't overwrite options
2016-08-22 16:40:03 +02:00
Steve
92baa9c73f Throw error on call to L.Polygon getCenter before map add (#4820)
* Throw error on call to L.Polygon getCenter before map add

References #4740

* add polyline handling, tests, and docstring
2016-08-15 17:01:41 +02:00
Iván Sánchez Ortega
09937e39b0 Add a _leaflet_id to the map container to fix #4806 (#4810) 2016-08-11 09:10:46 +02:00
Yohan Boniface
a0ee68558f Close non permanent tooltip on map click on touch (fix #4741) 2016-08-02 16:55:17 +02:00
Yohan Boniface
8047b0b7a9 Make sure we call event listeners in the order they are registered (fix #4743) (#4769) 2016-08-02 17:53:06 +03:00
Yohan Boniface
e746211be7 Better tooltip offset handling (fix #4772) (#4773)
- 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
2016-08-02 17:51:22 +03:00
Yohan Boniface
fc1dc96638 Allow to call bindTooltip on a layer not yet added to a map (fix #4778) (#4779) 2016-08-02 17:50:53 +03:00
Vladimir Agafonkin
94303a681b Merge pull request #3952 from Leaflet/label
Implement L.Label
2016-07-15 13:06:36 +03:00
Per Liedman
0bcfbdb537 Cleanup, tests and minor bug fixes for event system 2016-07-08 15:01:38 +02:00
Fabian Zeindl
0210071dad refactoring of events, it should be about 4 times faster now 2016-07-08 14:47:02 +02:00
Yohan Boniface
64ba1f7f95 Rename Label in Tooltip, PopupBase in DivOverlay 2016-07-08 13:51:18 +02:00
Yohan Boniface
fe3649f032 Default L.Label border and tip to white 2016-07-08 11:33:53 +02:00
Yohan Boniface
bd2616f901 Do not rely on options.draggable to compute draggableMoved (#4638)
One can enable dragging of a marker after it has been initialized
with draggable=false.
2016-07-08 11:22:54 +02:00
Yohan Boniface
f8221e09f7 We now load CSS in Phantom, so no need to skip those tests 2016-07-08 11:08:25 +02:00
Yohan Boniface
0dd58bd01f Merge branch 'master' into label 2016-07-08 11:07:22 +02:00