Commit Graph

3427 Commits

Author SHA1 Message Date
468a292034 Fix undefined iconAnchor (#8084) 2022-03-25 15:17:45 +02:00
4f639a85ef Map is panned to show markers when they're focused (#8042)
* Map is panned to show markers when they're focused

Should fix #8040

* Make eslint happy.
2022-03-09 00:15:03 +01:00
92906fdbcf Prevent false map click after fast dragging of marker (#7446)
* Fix final position after dragging

1. For unclear reason `_startPos` was set wrong (increasing it for offset of first move event),
   so we fix that, like it was in initial implementation (no idea why it was ever changed).
   (2d2fc74110 (diff-d8f00e9d1726fd6483110dc44c93d9f8R84))

2. Make sure that final position is set always, even after cancelAnimFrame.

* Prevent false map click after fast dragging of marker

To solve this we have to ensure that draggable final position is already set on the time
of mouseup/touchend. Thus we have only option - reject using of requestAnimationFrame,
which was originally introduced to fix performance issues of map panning, see
c93d91bfad (diff-46eca63ac2c5237cbd2d45c8a60f6ee28ce34231aef53669247ead03f012dff2)

Perhaps browsers evolved since then.

* Adapt test to expect exact position values

(as we do not depend on timings anymore)

* CanvasSpec: fix a test

* Replaced checks with `nearLatLng`

* Add missing brackets

Co-authored-by: falke-design <design.falke@gmail.com>
2022-02-22 12:49:13 +02:00
9ede551091 zoom event was not fired anymore while pinch zoom (#8015)
* zoom event not fired anymore while pinch zoom

* Fix problem with fastframe
2022-02-21 18:00:06 +02:00
354a28022f Update Control.Layers collapsed description (#8008) 2022-02-21 16:53:23 +02:00
47fa11ac34 Fix HTML error in Layer Control, Fix #6434 (#7914)
* Fix HTML error in Layer Control

https://github.com/Leaflet/Leaflet/issues/6434

* Update Control.LayersSpec.js
2022-02-07 22:56:01 +02:00
47c5d379d5 Add possible false to docu of prefix (#7814)
Co-authored-by: Simon Legner <simon.legner@gmail.com>
2022-02-07 22:55:11 +02:00
dfff7704a2 Make tooltips interactive themselves (#7532)
* Tooltip: process pointer events itself

Now it's possible to attach listeners to tooltip

* DivOverlay: inherit from Interactive Layer

* DivOverlay: process 'interactive' option

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2022-02-07 10:51:35 +02:00
662388bc51 LayerGroup: inherit from Interactive layer (#7763) 2022-02-07 10:33:09 +02:00
688f119942 Hide the attribution separator from ATs (#7969)
Co-Authored-By: nkreer <15277434+nkreer@users.noreply.github.com>

Co-authored-by: nkreer <15277434+nkreer@users.noreply.github.com>
2022-02-06 22:01:34 +02:00
48a38c797b Fix Marker position while zooming (#7967) 2022-02-05 00:41:39 +02:00
f1f4e05ba1 Add referrerPolicy to TileLayer (#7945)
* add referrerPolicy to TileLayer, fixes #7943

* fix typo in docstring

HT: https://github.com/Leaflet/Leaflet/pull/7945#discussion_r792419377

* drop the "true" option handling for the new referrerPolicy TileLayer option

https://github.com/Leaflet/Leaflet/pull/7945#discussion_r793113681
2022-01-27 03:23:41 +01:00
e4e4d5b7ab Add playsInline attribute on the video element (#7928) 2022-01-21 13:53:19 +01:00
fb0b2a169e Refactor Popup/Tooltip to use common code from DivOverlay (#6639)
* Refactor openPopup/Tooltip to use common functions [Map/Layer]\_initOverlay

* DivOverlay: common functions openOn/close

Refactor [Map\Layer] open/close-Popup/Tooltip to use DivOverlay's openOn/close

* DivOverlay: new public method `toggle`

Refactor Layer\ togglePopup/Tooltip: use common method DivOverlay\toggle

Popup: do not clear map._popup on close as it's redundant
2022-01-19 12:29:56 +02:00
10d003152a Update marker: role=button, alt=marker (#7895)
* Update marker: default role=button, default alt=marker

* fix marker test

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2022-01-10 19:07:16 +02:00
911f578a60 Replace http with https (#7860) 2021-12-16 12:48:50 +01:00
abf16d5a2c Update the doc of DivOverlay (#7778)
* Update the doc of DivOverlay

* Moved popup options from DivOverlay to Popup
2021-12-16 11:35:59 +02:00
26ba65ae11 Fix opening / closing tooltip while dragging map (#7862)
* Fix opening / closing tooltip while dragging map

* Fix lint

* Update src/layer/Tooltip.js

Co-authored-by: johnd0e <johnd0e@mail.ua>

Co-authored-by: johnd0e <johnd0e@mail.ua>
2021-12-15 17:40:24 +02:00
e9fc60c022 Fixup #7544 (#7861)
* Remove redundant condition

Source: 7c2ac9f39d (diff-f7c61cee5bee8604986cfce68530ef8df7316a4e93ea6a2ddfb6e97fa4234421R662)

* Fix issue when contextmenu was prevented on map even w/o real listeners
2021-12-13 16:22:25 +02:00
acffb7edf8 Set role=button on the Layer control (#7850) 2021-12-10 18:59:16 +02:00
afe38e09d9 Add getCenter to ImageOverlay (#7848) 2021-12-10 18:58:57 +02:00
80b268525e Better icon image path detection (#7092) 2021-12-05 12:32:19 +02:00
a340c086c2 Break the reference to the options of the Class prototype (#7459)
* Break the reference to the options of the Class prototype

* Refactor test and .setOptions

* Revert: Merge https://github.com/Leaflet/Leaflet into class_options
2021-12-02 20:02:49 +02:00
30d91b1769 Fix Bug: permanent & sticky tooltip (#7563)
* Fixes bug: if tooltip is sticky and permanent it was not following the mouse

* Add tests

* Use fastframe

* fix whitespace

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2021-12-02 20:01:17 +02:00
4b2946c205 Correct condition to add zoom limits for Layer (#7609) 2021-12-02 19:59:47 +02:00
e7d5a3725f Locate - locationfound: Add check if map container has leaflet_id / is existing (#7813)
* Add check if map container has the leaflet_id

* Fix lint

* Use private _container

* Add test for _handleGeolocationError

* Update test text

* Change text of test
2021-12-02 19:59:14 +02:00
e8b87eacf5 bindTooltip should unbind existent tooltip (#7633)
* Fix overlapping permanent tooltip on bindTooltip

Fix overlapping permanent tooltip on bindTooltip

* Update test

* Fix lint errors

* Using sinon.spy on a function of layer

* unwrap spy in the test

* move spy restore
2021-12-02 19:51:38 +02:00
2476975c65 makes L.Browser mutable (#7335)
* makes L.Browser mutable

* reverts fix to tilelayer min/maxzoom detectRetina issue

Co-authored-by: bozdoz <howaboutben@gmail.com>
Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2021-12-02 19:45:11 +02:00
27f49645ef Update zoom buttons documentation text (#7815) 2021-11-30 16:42:26 +01:00
2e8638761c [GridLayer] redraw tiles properly after changing maxNativeZoom (#6443) 2021-11-26 17:39:17 +02:00
05fa5802a6 New TapHold handler instead of legacy Tap (#7026)
* Replace legacy over-functional Tap handler with much simpler TapHold handler

as currently it is needed only for single purpose: emulate `contextmenu` on iOS.

* `tapHold` map option can be forced now

Anyway, this option is not meant to be explicit,
any overriding is useful for debug purposes only.

* Remove Map.Tap

* Get rid of deprecated initMouseEvent

Use MouseEvent constructor.

Note: some properties are commented out, as they may vary between browsers.

Ref:
- https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/initMouseEvent
- https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent

Compatibility:
- https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent/MouseEvent#browser_compatibility

Some legacy browsers lacks support, but here we care only about iOS Safari.
(Anyway it can be solved with polyfill)

* Add tests for Map.TapHold.js
2021-11-26 13:38:24 +02:00
38c0c55ff0 Fix #7439 for mousemove (#7809)
We need pass event to map when canvas does not have targets
2021-11-26 13:07:16 +02:00
18389fbe70 Improve panInside documentation (#7397)
* Improve panInside doc and add arg check

* Removed unwanted parameter check.

* Throw when padding value is not a point, plus test

* New padding options docs and error checking

* Update src/map/Map.js

Co-authored-by: johnd0e <johnd0e@mail.ua>

* Error checking for fitBounds and flyToBounds

* Separate padding options tests

* Comment update on padding tests

* Revert padding checks and associated tests

* Remove extra blank line

Co-authored-by: johnd0e <johnd0e@mail.ua>
Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2021-11-26 11:23:07 +02:00
8fbb149371 Update Renderer documentation to clarify tolerance option Canvas only (#7515)
* update renderer doc to clarify tolerance option Canvas only

* Revert "update renderer doc to clarify tolerance option Canvas only"

This reverts commit 6d9e82fc20.

* moved tolerance option from Render to Canvas

* Refactor _clickTolerance

Co-authored-by: johnd0e <johnd0e@mail.ua>

Co-authored-by: johnd0e <johnd0e@mail.ua>
2021-11-26 11:14:30 +02:00
649eaf37e5 Add documentation for Event Listens Propagate argument. Fixes Leaflet/Leaflet#6912 (#7103) 2021-11-26 10:38:03 +02:00
6db8d22b61 Add aria-hidden to the +/- characters of zoom controls (#7795)
* Add aria-hidden to zoom controls #7433

* Fix lint

* Move aria-hidden to the `zoomIn\OutText`

* Update src/control/Control.Zoom.js

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2021-11-26 00:00:07 +02:00
4dadf840af Fix Popup keepInView if the map needs to panned over a long distance (#7792)
* Fix keepInView recursion #5035

* Fix test

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2021-11-25 20:34:19 +02:00
1180e7e8c2 Accessibility popup close button (#7794)
* Change color of close button #7539

* Add role=button and aria-label #7399

* Add aria-hidden to `times` / `x` #7472

* remove bold on close button

Co-authored-by: Vladimir Agafonkin <agafonkin@gmail.com>
2021-11-25 19:50:18 +02:00
5eca46962d add/removePointerListener: tolerate wrong event names (#7808) 2021-11-25 16:47:35 +02:00
dd1ab61bd1 Fixup #7068 and add test (#7781) 2021-11-16 00:48:08 +02:00
c1e6751f5c L.Control.Attribution: encapsulate some code from L.Layer (#7764) 2021-11-11 10:14:21 +02:00
315e4d7bde Class.include: keep parent options (#7756)
And add a couple of related tests
2021-11-08 19:16:42 +02:00
4ec3c5f963 Fixup #7518 (#7748) 2021-11-06 17:07:28 +02:00
b4a1556132 Run tests on Internet Explorer 11 (#7741)
Co-authored-by: johndoe <johnd0e@mail.ua>
2021-11-06 13:15:40 +01:00
5b9458e82e Change undefined argument handling in Layer/hasLayer() and LayerGroup/hasLayer() (#6999)
undefined/null/false are not considered as special case anymore,
`layer` argument is always required, as per docs.

Previous excessive tolerance may lead to real errors get masked.
2021-11-05 14:29:35 +02:00
9e03bc5f59 Restore DomEvent.off(el) functionality when calling with one arg (#7125) 2021-11-05 14:18:25 +02:00
36d4858bf3 Evented: protect from common errors (+tests) (#7518)
* Evented:_off: get rid of redundant condition

* Evented:_off: minor optimization of case when remove happens in fire

* Evented:_off: prevent removing all listeners when false fn argument specified (by mistake)

* Evented:_on,_off: ignore non-function listeners passed

* Evented:_on,_off: throw on wrong types passed

* Evented: console.warn on common errors
2021-11-05 12:28:00 +02:00
bcc6730a8b cleanup marker.svg (#7600)
Co-authored-by: Raphael Lackner <Raphael.Lackner@cloudflight.io>
2021-11-03 21:10:14 +02:00
7b15104f2f Avoid modifying source props object in Class.extend (#6766)
* Class.extend: do not modify source props.options

`extend` method had side effects:
- (if parent prototype has options) props.options got rewritten
- (if parent does not have options) props.options object was used directly

that behavior was undesirable, as it prevented to reuse props.
E.g. this case had unexpected behavior:

var props = {
  // ...
  // some useful props and methods
}

var MyLine = L.Polyline.extend(props);

var MyGon = L.Polygon.extend(props);

var line = new MyLine([]);

var gon = new MyGon([]);

console.log(line.options.fill, gon.options.fill);
// Output expected:   false, true
// Output before fix: false, false

* Class.extend: do not modify source props object

Previously 'statics' and 'includes' were removed,
that prevented source props reusing
2021-11-03 19:39:42 +02:00
cc9f327b41 Allow to prevent round-off errors, caused by formatNum (#7100)
* GeoJSON.latLngToCoords: do not force default precision value

Rely on default value defined in `formatNum` itself.
Specify all related docs.
Document `precision` argument of `latLngsToCoords` function.

* Util.formatNum: allow to skip processing specifying `false` as precision

This is most necessary for cases where `formatNum` is called indirectly,
e.g. by GeoJSON functions.
2021-11-03 19:07:54 +02:00