Commit Graph

6852 Commits

Author SHA1 Message Date
bae0e4dadc Inline default icons as data:svg+xml URLs, remove def. icon path detection 2020-07-08 15:53:30 +02:00
9644fcfcfc Get rid of some legacy IE-related pointer quirks. (#7195)
That code was initially intended to support mspointer-touch, but currently
same code paths are used in any PointerEvent-enabled browser, and may cause
real issues (e.g. that broke Leaflet.draw).

Note:
It's known that preventDefault is needed for correct processing of touch in IE10.
But I haven't found any evidence that it is required for IE11, so I've removed some
excessive code.
It's blind shot as I have no IE10-11 devices to test, but it will be easy to fix on request.
2020-07-06 16:52:40 +03:00
14b1985ca4 docstrings: fix parameters for LatLngBounds.overlaps (#7194) 2020-07-02 12:20:15 +02:00
e8c28b9961 docstrings: Layer's removeFrom works on LayerGroups too 2020-06-11 11:07:29 +02:00
25f7bbb93d docs: update URL about NPM in plugin developer guide (#7161) 2020-05-28 20:50:16 +02:00
1d09819922 Update FeatureGroup's factory method (#7160)
Fixes #7159
2020-05-25 07:36:33 +02:00
5b30f7d344 fix tooltipAnchor behavior for different directions (#7155)
This commit fixes issue #6764, see the discussion examples there.
It's an alternative implementation for pull request #6116.

It makes `tooltipAnchor` behave the same like `popupAnchor` regardless of the tooltip's direction. With one exception: the `auto` direction flips the `x` axis of `tooltipAnchor` and the tooltip's `offset` when it switches to `left` depending on the position on the screen. `auto` therefore assumes that the icon is somewhat symmetrical to the left and the right of the y axis, which is the case for the default icon.
2020-05-24 18:30:37 +03:00
838587dff0 L.Marker shadowPane doc fix (#7135) 2020-05-19 09:57:48 +03:00
9b0d7c2a70 Update dev dependencies, fix most of vulnerabilities (#7133)
* Update rollup-plugin-git-version to ^0.3.1

* Update uglify-js to ^3.9.2

* Update git-rev-sync to ^2.0.0

* Update ssri to ^8.0.0

* Update rollup to ^0.59.4

(latests version with support of IE 8)

Remove Object.freeze hack, use rollup's `output.freeze` option instead

* Update eslint to ^5.16.0

And fix a couple of warnings.
Ref:
https://eslint.org/docs/user-guide/migrating-to-5.0.0#eslint-recommended-changes
https://eslint.org/docs/user-guide/migrating-to-5.0.0#deprecated-globals

* Update eslint to ^6.8.0

Ref:
https://eslint.org/docs/user-guide/migrating-to-6.0.0#eslint-recommended-changes
2020-05-19 00:25:15 +03:00
ec35ab52f6 GridLayer: fix _updateLevels and _removeTilesAtZoom (#7123)
Because of particular quality of `for ... in` loop, type of `z` is 'string'.
Thus condition `z === zoom` never met in _updateLevels.
Considering wrong arg type, _removeTilesAtZoom also never had any action.

Cleaner solution would be to iterate `Object.keys()` instead, but it is available only since IE 9.
2020-05-04 14:24:08 +03:00
e7a5c6ffbf Add more browser profiles and fix some tests (#7115)
* MapSpec.js: fix: mocked function must be restored

Otherwise it will break crs.project test in CRSSpec.js

* MapSpec.js: skip broken test

crsMock.verify() call is mandatory here, but it shows that crs.project is never called,
thus the test is not ever valid.

* MapSpec.js: fix non-valid test

Revert 50a4845a78 and 1b1d96a4c4,
and refactor a bit (rather cosmetical changes)

* MapSpec.js: fix more tests

Refactor before/afterEach hooks for more careful setup/cleanup.

Fix some non-valid tests:
* #remove
  - "undefines container._leaflet"
  - "unbinds events"
* #removeLayer
  - "when the last tile layer on a map is removed"
  - "when a tile layer is removed from a map and it had greater zoom level coverage than the remainding layer"
  - "when a tile layer is removed from a map it and it had lesser or the sa,e zoom level coverage as the remainding layer(s)"

* GridLayerSpec.js: fix some tests

Refactor before/afterEach hooks for more careful setup/cleanup.

Fix some non-valid tests:
* "when a tilelayer is added to a map that already has a tilelayer"

* spec/suites/**: refactor for more careful setup/cleanup

Refactor before/afterEach hooks
Other minor changes

* SpecHelper.js: rename skipIn(non)Phantom to skipIf(No)3d

..to make things more clear

Remove unused helper functions

* Update testing deps

sinon.js: left on 7.5.0 (latest still working on PhantomJS)

karma-rollup-preprocessor: left on 6.1.2 (latest still supporting rollup < 1.0.0)

* CRSSpec.js: workaround round-off error in Chrome

L.CRS.zoom(L.CRS.scale(2.5)) results 2.4999999999999996 in Chrome

Note: comparing floating point numbers properly is hard,
e.g. see https://randomascii.wordpress.com/2012/02/25/comparing-floating-point-numbers-2012-edition/

* Fix touch tests failing in Chrome

* karma.conf.js: add custom Chrome config to make some tests pass

npm run test-nolint -- --browsers Chrome1280x1024

* spec/.eslintrc: do not forbid no-unused-vars rule

* spec/.eslintrc: do not forbid more rules

no-extend-native
no-irregular-whitespace
no-shadow

* Add karma-edge-launcher

* Add karma-ie-launcher

Some test fails atm, see log:

> karma start ./spec/karma.conf.js "--browsers" "IE"

................................................................................
.....
WARN: 'Deprecated include of L.Mixin.Events: this property will be removed in future releases, please inherit from L.Evented instead.', undefined
................................................................................
................................................................................
...............................................................
IE 11.0 (Windows 10) ImageOverlay _image when loaded should raise the load event FAILED
	TypeError: Argument not optional
	   at raiseImageEvent (spec/suites/layer/ImageOverlaySpec.js:66:4)
	   at Anonymous function (spec/suites/layer/ImageOverlaySpec.js:74:5)
IE 11.0 (Windows 10) ImageOverlay _image when load fails should raise the error event FAILED
	TypeError: Argument not optional
	   at raiseImageEvent (spec/suites/layer/ImageOverlaySpec.js:66:4)
	   at Anonymous function (spec/suites/layer/ImageOverlaySpec.js:83:5)
IE 11.0 (Windows 10) ImageOverlay _image when load fails should change the image to errorOverlayUrl FAILED
	TypeError: Argument not optional
	   at raiseImageEvent (spec/suites/layer/ImageOverlaySpec.js:66:4)
	   at Anonymous function (spec/suites/layer/ImageOverlaySpec.js:88:5)
..
IE 11.0 (Windows 10) ImageOverlay #setZIndex should update the z-index of the image if it has allready been added to the map FAILED
	Error: expected 1 to equal '1'
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.equal (node_modules/expect.js/index.js:216:5)
	   at Anonymous function (node_modules/expect.js/index.js:69:13)
	   at Anonymous function (spec/suites/layer/ImageOverlaySpec.js:111:4)
IE 11.0 (Windows 10) ImageOverlay #setZIndex should set the z-index of the image when it is added to the map FAILED
	Error: expected 10 to equal '10'
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.equal (node_modules/expect.js/index.js:216:5)
	   at Anonymous function (node_modules/expect.js/index.js:69:13)
	   at Anonymous function (spec/suites/layer/ImageOverlaySpec.js:121:4)
IE 11.0 (Windows 10) ImageOverlay #setZIndex should use the z-index specified in options FAILED
	Error: expected 20 to equal '20'
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.equal (node_modules/expect.js/index.js:216:5)
	   at Anonymous function (node_modules/expect.js/index.js:69:13)
	   at Anonymous function (spec/suites/layer/ImageOverlaySpec.js:127:4)
........................................................................
IE 11.0 (Windows 10) Marker.Drag drag in CSS scaled container drags a marker with mouse, compensating for CSS scale FAILED
	expected 0 to be within -50..-30 (node_modules/expect.js/index.js:102)
................................................................................
...........................................................
WARN: 'Deprecated use of _flat, please use L.LineUtil.isFlat instead.'
.
WARN: 'Deprecated use of _flat, please use L.LineUtil.isFlat instead.'
.......................................................................... 05 2020 15:25:48.917:WARN [web-server]: : /000
 05 2020 15:25:48.938:WARN [web-server]: : /000
......
..
IE 11.0 (Windows 10) Map #invalidateSize pans by the right amount when growing in 1px increments FAILED
	Error: expected 0 to equal 1
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.equal (node_modules/expect.js/index.js:216:5)
	   at Anonymous function (node_modules/expect.js/index.js:69:13)
	   at Anonymous function (spec/suites/map/MapSpec.js:649:4)
IE 11.0 (Windows 10) Map #invalidateSize pans by the right amount when shrinking in 1px increments FAILED
	Error: expected 0 to equal -1
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.equal (node_modules/expect.js/index.js:216:5)
	   at Anonymous function (node_modules/expect.js/index.js:69:13)
	   at Anonymous function (spec/suites/map/MapSpec.js:667:4)
..
IE 11.0 (Windows 10) Map #invalidateSize emits a move event if the size has changed FAILED
	Error: expected false to be truthy
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.ok (node_modules/expect.js/index.js:115:5)
	   at Anonymous function (node_modules/expect.js/index.js:499:7)
	   at Anonymous function (spec/suites/map/MapSpec.js:700:4)
IE 11.0 (Windows 10) Map #invalidateSize emits a moveend event if the size has changed FAILED
	Error: expected false to be truthy
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.ok (node_modules/expect.js/index.js:115:5)
	   at Anonymous function (node_modules/expect.js/index.js:499:7)
	   at Anonymous function (spec/suites/map/MapSpec.js:710:4)
IE 11.0 (Windows 10) Map #invalidateSize debounces the moveend event if the debounceMoveend option is given FAILED
	Error: expected false to be truthy
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.ok (node_modules/expect.js/index.js:115:5)
	   at Anonymous function (node_modules/expect.js/index.js:499:7)
	   at Anonymous function (spec/suites/map/MapSpec.js:724:4)
IE 11.0 (Windows 10) Map #invalidateSize correctly adjusts for new container size when view is set during map initialization (#6165) FAILED
	Error: expected 0 to equal 100
	   at Assertion.prototype.assert (node_modules/expect.js/index.js:102:7)
	   at Assertion.prototype.equal (node_modules/expect.js/index.js:216:5)
	   at Anonymous function (spec/suites/map/MapSpec.js:745:4)
................
IE 11.0 (Windows 10) Map #fitBounds after layers set Snaps to a number after adding tile layer FAILED
	Error: Access is denied.

	   at createTile (src/Leaflet.js:11698:3)
	   at _addTile (src/Leaflet.js:11433:3)
	   at _update (src/Leaflet.js:11330:5)
	   at _setView (src/Leaflet.js:11191:5)
	   at _resetView (src/Leaflet.js:11146:3)
	   at onAdd (src/Leaflet.js:10784:3)
	   at _layerAdd (src/Leaflet.js:6580:3)
	   at Events.fire (src/Leaflet.js:588:6)
	   at _resetView (src/Leaflet.js:4184:4)
	   at setView (src/Leaflet.js:3181:3)
..............................
IE 11.0 (Windows 10) Map.Drag mouse events in CSS scaled container change the center of the map, compensating for CSS scale FAILED
	expected 31.952162238024975 to be within 21.943..21.9431 (node_modules/expect.js/index.js:102)
IE 11.0 (Windows 10) Map.Drag touch events change the center of the map FAILED
	Object doesn't support this action (node_modules/prosthetic-hand/dist/prosthetic-hand.js:624)
IE 11.0 (Windows 10) Map.Drag touch events does not change the center of the map when finger is moved less than the drag threshold FAILED
	Object doesn't support this action (node_modules/prosthetic-hand/dist/prosthetic-hand.js:624)
IE 11.0 (Windows 10) Map.Drag touch events reset itself after touchend FAILED
	Object doesn't support this action (node_modules/prosthetic-hand/dist/prosthetic-hand.js:624)
.............
IE 11.0 (Windows 10) Map.TouchZoom Increases zoom when pinching out FAILED
	Object doesn't support this action (node_modules/prosthetic-hand/dist/prosthetic-hand.js:624)
IE 11.0 (Windows 10) Map.TouchZoom Decreases zoom when pinching in FAILED
	Object doesn't support this action (node_modules/prosthetic-hand/dist/prosthetic-hand.js:624)
IE 11.0 (Windows 10): Executed 685 of 688 (20 FAILED) (skipped 3) (25.993 secs / 22.211 secs)

* karma.conf.js: additional Firefox configs

- FirefoxPointer
- FirefoxTouch
- FirefoxPointerTouch

* .travis.yml: run CI tests with different Firefox configs

Use FirefoxHeadless

* karma.conf.js: change reporter to default ('progress')

Because 'dots' is confusing when mixed up with different warnings.

But for CI script 'dots' fits better due to travis-ci log qualities.

* .travis.yml: run CI tests with Chrome too
2020-05-04 14:19:14 +03:00
19da01346d Fix DivOverlay.getElement function documentation (#7111) 2020-04-29 16:40:35 +03:00
1ae785b730 Docs: Fix tiny typo - WMTS vs WTMS (#7098) 2020-04-17 15:54:16 +02:00
984fedda1c VideoOverlay feature: Enable to load muted video (#7071)
* Enable to load muted video

* Changes after CR

Co-authored-by: r <r>
2020-04-16 11:32:38 +02:00
0fd2f43faa Fix tiles flickering when maxNativeZoom === maxZoom (and same with min-) (#7094)
GridLayer/_setView: check max/minZoom before clamping to max/minNativeZoom
2020-04-16 11:15:02 +03:00
41706c0168 Popup: fix event propagation to popup._container (#7091) 2020-04-14 18:51:14 +03:00
09da971160 Update mocha to ^7 (#7082) 2020-04-10 15:49:52 +03:00
9be733ee38 DomEvent: use passive for touchmove (instead of touchend) (#7060)
* DomEvent: use passive for touchmove (instead of touchend)

Ref: https://developers.google.com/web/tools/lighthouse/audits/passive-event-listeners

* Remove excessive brackets from condition

* DomEvent: simplify more conditions

Also add passive option for `wheel` event listeners
(previously it was supported for `mousewheel` only)

* Prefer `wheel` over `mousewheel` throughout sources
2020-04-10 10:14:49 +03:00
092070d64f Canvas events handling: do not block events on dragging (#7068) 2020-04-10 10:12:18 +03:00
167a46da26 Added tests for Bounds.overlaps and Bounds.intersects. (#7075) 2020-04-10 10:11:22 +03:00
d843c3b884 Attach pointer tracker listeners to document (instead of documentElement) (#7041)
Otherwise it's not possible to capture events in some cases.
2020-03-23 12:02:45 +02:00
c2b4d7e1aa Fix invalid condition in _addPointerStart (#7033)
* Fix bug introduced in 19d2bd027e (brackets missing)

The condition was never met: `e.pointerType !== 'mouse' && e.MSPOINTER_TYPE_MOUSE`

* fixup! Fix bug introduced in 19d2bd027e (brackets missing)

Co-Authored-By: Vladimir Agafonkin <agafonkin@gmail.com>

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2020-03-23 12:00:54 +02:00
61219d38ed adjust "trusted by the best" block 2020-03-20 12:16:27 +02:00
77b756f07c subtly improve website contrast, close #6921 2020-03-20 12:11:39 +02:00
a6b5ca192a only keep reference docs for latest minor versions 2020-03-20 11:47:14 +02:00
95c4366381 Fix some issues related to wrong Browser.pointer value (#7010)
* Revert "Fix pointer event hendling on iOS13 (#6855)"

This reverts commit 747b1f73f9.

Close #6977

* Fix iOS contextmenu issue in more proper way

Ref: #6817

* Fix iOS dblclick issue in more proper way

* dblclick emulation: simplify code paths a bit

* Make use of PointerEvent.isPrimary

https://developer.mozilla.org/en-US/docs/Web/API/PointerEvent/isPrimary
https://caniuse.com/#search=isPrimary

IE 10 or later, but it is safe to use here, as for IE we anyway need return from function.
2020-03-20 11:37:07 +02:00
5185a6bff4 Fix Microsoft Edge support (pre-Chromium) (#7023)
* Prevent Browser.chrome = true for pre-Chromium Edge

Sample user agent string:
"Mozilla/5.0 (Windows NT 10.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/64.0.3282.140 Safari/537.36 Edge/18.17763"

* fixup! Another blind attemp to work around dblclicks on Edge (#5268)

Fix leftover that was meant to change in 2b5d401976
2020-03-20 11:34:07 +02:00
efe5c41435 Update plugins.md (#7038)
Added proposed 3rd party integration: WP-Trip-Summary WordPress plug-in that uses LeafletJS as a mapping component.
2020-03-20 11:27:37 +02:00
5902241ff9 Fix: listeners were not removed because of missed context (#7036) 2020-03-20 11:26:28 +02:00
e213469a29 Remove legacy click filter, targeted android 4.x (#7013) 2020-03-11 16:53:56 +02:00
05a9bdbb8e remove disqus integration to cut back spam (#7018) 2020-03-11 13:13:02 +02:00
67102996d0 Use passive event listeners for touchstart/touchend (#7008)
* Use passive event listeners

To fix the error "Does not use passive listeners to improve scrolling performance" on Lighthouse audit (https://web.dev/uses-passive-event-listeners/?utm_source=lighthouse&utm_medium=devtools)

* Specific condition touch

Add a specific condition on touchstart and touchend with a passive mode
2020-03-11 13:12:45 +02:00
c6d8a51da3 Update WMS tutorial using Mundialis WMS (#4239) 2020-03-11 12:56:38 +02:00
a47f323994 Fix Contrib doc for jekyll install (issue #4239) 2020-03-11 12:56:38 +02:00
5e93da5c70 Fix JS error on non-mobile devices (issue #4239) 2020-03-11 12:56:38 +02:00
a4422ed395 Updates links in plugins.md (#7016)
My links have changed places
2020-03-11 12:55:40 +02:00
0d06c4256f docs: fix: map/setMaxBounds argument is LatLngBounds (#7001) 2020-02-19 23:39:30 +01:00
f662d44af5 Fix exception when calling LayerGroup/hasLayer() with wrong layerId (#6998)
Now `false` returned, as per docs
2020-02-18 15:03:04 +01:00
cd12b94a4d [docs] correct Mapbox examples' tileSize (#6995)
* update debug pages

* correct tileSize & zoomOffset for all Mapbox examples
2020-02-14 01:49:03 +01:00
fc0e4a8f0d fix: Don't call potentially undefined closePopup function (#6962)
As a result of using importing Marker as ES6 module and *not* importing Popup the function `closePopup` does not exist on the marker object.

This is a quick fix. A better approach would be to make the popup register a move listener on the marker, while its open. And then close itself when the marker is moved.

Closes #6961
2020-02-03 15:14:58 +01:00
3acb64d900 fix broken url template link (#6982)
went to the right page, but an invalid heading
2020-01-27 15:49:17 +02:00
d1a1e97b82 Fix error with bind function in esm build (#6970)
Use bind function imported from the Util ES module instead of the one
from the global L namespace. Using the L namespace breaks the esm build.
2020-01-16 12:03:34 +02:00
17a1b6105b README: update JS size, add CSS size (#6964)
* README: update JS size to 39 KB

https://unpkg.com/leaflet@1.6.0/dist/leaflet.js amounts to 39.45 KB gzipped

* README: mention 4 KB of CSS

https://unpkg.com/leaflet@1.6.0/dist/leaflet.css amounts to 3.65 KB gzipped
2020-01-09 10:29:25 +01:00
1e2e1c83ea fix(Map): rm moveend listener from setMaxBounds (#6958)
Calling `map.setMapBounds`, adds the `"moveend"` event listener
`_panInsideMaxBounds`. Previously, this did not get cleaned up via
`remove`.
2020-01-08 14:26:56 +02:00
0603741cf7 Prefix IE-specific "zoom" CSS property
Supersedes #6960
2020-01-07 11:10:53 +01:00
e4b4900084 Plugins: Add simplestyle and SvgShapeMarkers (#6949) 2019-12-20 11:20:50 +01:00
983092a497 Pluralize 'layers control'. (#6944)
To align it with the way L.Control.Layers is called/documented.
2019-12-18 19:40:50 +02:00
6b15001bf1 Update author name and URLs for Leaflet.TileLayer.Swiss plugin (#6942)
Note: The author is still the same person (me), I just changed my name.

This can be verified for example by checking that
   https://github.com/rzoller/Leaflet.TileLayer.Swiss
forwards to the new repo URL.
2019-12-16 10:02:14 +02:00
3b9fe956e2 docstrings: disordered comments (#6939) 2019-12-13 14:52:08 +01:00
104ccba4a0 Plugins: add leaflet-zoompanel control (#6673) 2019-12-12 15:17:36 +01:00