Commit Graph

352 Commits

Author SHA1 Message Date
ghybs
fe9e0f2333
Fix(Draggable): compensate for container CSS scale (#6055)
* Test(MapDragSpec): add mouse drag with CSS scaled container

This test is failing as of this commit.

* Fix(Draggable): measure drag compensating for CSS scale

so that the computed offset (i.e. user drag length) is divided by the CSS scale applied on the `_element`'s container. Later on when `Draggable` updates the `_element`'s position, the latter is affected by the CSS scale by the browser.
Added a `getSizedParentNode` function in `DomUtil` in order to automatically retrieve the closest parent node in the DOM hierarchy tree that has a non null size (so that we can compute the scale in `DomEvent.getMousePosition`), without having to specify the parent node explicitly (which is ugly).

* Fix(getMousePosition): getBoundingClientRect is in page scale

therefore it must also be divided by the container scale in order to compute the relative position of the event in the scaled container.

* Test(MarkerDragSpec): add drag with CSS scaled container

this should pass automatically at this commit, thanks to the previous modification of Draggable.

* Debug(map-scaled): add draggable marker

as well as another CSS scaled wrapper, plus some border and padding, and debugging console logs, to make sure the computations of `getMousePosition` are correct (correctly removing the border width, and compensating for CSS scale).

* Docs(getMousePosition): explicitly exclude border

* Docs(DomUtil): add return value of getSizedParentNode

was missing in docstring.

* Feat(DomUtil): add getScale function

so that it can be used by DomEvent.getMousePosition and Draggable.

* Refactor(Draggable): cache container scale

to avoid triggering browser reflow continuously during _onMove, but only on drag start (_onDown).
By compensating for the scale within Draggable instead of delegating to DomEvent.getMousePosition, it also becomes possible to check first for the clickTolerance, so that we prevents user's small movement based on screen, irrespective of rendered scale.

* Test(Map+MarkerDrag): remove scale on initial movement

that is intended to overcome Draggable clickTolerance, since now it is based on screen pixels, irrespective of applied CSS scale on the map.
Thanks to the tolerance in the expected final position, this has no effect on the result of the test, even though the overall drag is now slightly shorter.

* Refactor(DomEvent): use DomUtil.getScale in getMousePosition

to factorize scale computation (also used within Draggable).
2018-03-16 19:46:44 +04:00
Roman Zoller
5ffe207921 Use https everywhere for OSM links (#6082)
* Use https everywhere for OSM tile URLs

Use
https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

instead of
http://{s}.tile.osm.org/{z}/{x}/{y}.png
http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png

* Use https everywhere for OSM attribution link

Use
https://www.openstreetmap.org/copyright

instead of
http://www.openstreetmap.org/copyright
http://osm.org/copyright
2018-03-12 08:46:20 +01:00
Per Liedman
4bbec02d14 Add license to route
Fixes #2721.
2017-10-26 23:16:20 +02:00
Andrew
78152c9804 Merge pull request #4506 from Leaflet/layer-id-public
Switch to public api for getting the layer id in debug
2017-10-01 19:16:45 +02:00
Andrew
899bdd43de Fix zoom when map container is scaled (#5794)
* fix zoom when container is scaled

* add map-scaled debug page
2017-09-29 17:11:14 +03: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
Thach Hoang
96fd15450b Remove reference to deps.js in L.VideoOverlay debug example 2017-07-14 21:46:42 -04:00
Guillaume P
ac05f68a39 Canvas: call ctx.setLineDash in _fillStroke (#5454)
* Canvas: call ctx.setLineDash in _fillStroke

This make dashArray working properly for cirles.

fix #5182

* Debug: add dashed circle example

* Debug: add simple example reproducing #5182
2017-04-20 12:41:26 +02:00
Iván Sánchez Ortega
61ff641951 Add new class L.VideoOverlay (#4988)
* Add VideoOverlay class based on ImageOverlay

* Make linter happy

* Move VideoOverlay include to layer/index

* Fix mapbox tokens
2017-04-04 22:45:09 +02:00
Thach Hoang
0d1eae32be Fix debug examples after rollup (#5417)
Fix #5373.

- Remove references to removed file "../../build/deps.js"
- Update leaflet-include.js to point to "../dist/leaflet-src.js"
- Update watch to use the same destination file as rollup (dist/leaflet-src.js)
- Define getRandomLatLng where used
2017-03-28 08:40:48 +02:00
Lyzi Diamond
7391e308cc rotate access tokens (#5338) 2017-02-16 09:44:50 +02:00
Uzerus
cab880d4d8 type attribute not required in HTML5 2017-02-06 20:32:50 +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
Per Liedman
4c484462dc Canvas improvements (#5115)
* WIP refactor canvas clear

* Fix clearing bounds, remov unnecessary code

* Refactor redraw logic

* Remove flicker on update

* Fix code style

* Add support for layer ordering with bringToFront/bringToBack

* Fix redraw when layer moves

* Add example for moving canvas layers

* Fix code style

* Use layer ordering for mouse events

* Fix removing first or last layer
2016-11-18 15:22:35 +01:00
Jon Woyame
d5c499b732 limit css selectors for svg/canvas (#4597) 2016-11-11 10:45:34 +01:00
Per Liedman
d0d699bfa4 Fix missing variable 2016-11-10 11:07:53 +01:00
Per Liedman
957659fcd0 Move attribution option and getAttribution to L.Layer (#5070)
Close #5051.
2016-11-03 09:32:56 +01:00
Steve Kashishian
c624a3ed50 remove explicit image path on two debug pages 2016-09-29 15:12:08 -05: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
1a0b08226b Fix broken vector-simple debug/testbed page
`Uncaught TypeError: Cannot read property 'intersects' of undefined`, so rearrange order for an earlier `map.setView()`
2016-08-14 10:20:46 -05: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
Steve Kashishian
7738565a33 Remove usage of mapquest tiles from debug pages 2016-07-25 12:39:55 -05: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
Yohan Boniface
64ba1f7f95 Rename Label in Tooltip, PopupBase in DivOverlay 2016-07-08 13:51:18 +02:00
Yohan Boniface
a1e43ed3bb spaces to tabs in label.html debug page 2016-07-08 11:44:10 +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
2f4b97de19 Add support for "center" Label position 2016-07-02 10:52:04 +02:00
Yohan Boniface
14bfedf7ff Merge branch 'master' into label 2016-07-02 10:36:42 +02:00
Zsolt Ero
26df85e841 maxbounds example fixes (#4680) 2016-06-28 15:14:24 +02:00
Jon Woyame
268a57c077 add demo with both map and vector click events (#4601) 2016-06-01 17:27:47 +03:00
Yohan Boniface
4a9140e6b1 Add L.Label related documentation 2016-05-06 15:00:01 +02:00
Yohan Boniface
737137634e Rename Label clickable option to interactive 2016-05-06 13:39:09 +02:00
Yohan Boniface
b4b97277c4 Support top and bottom direction 2016-05-06 13:30:58 +02:00
Yohan Boniface
8a2255afc3 Merge branch 'master' into label 2016-04-30 14:36:48 +02:00
Nathan Cahill
425fa13cb4 Various debug fixes (#4515)
* various debug fixes
* fix mixed spaces and tabs
2016-04-29 12:35:50 +03:00
Nathan Cahill
3edf6036e5 use public api for getting the layer id 2016-04-25 17:30:04 -06:00
Nathan Cahill
a5cf6b9390 remove old CircleMarker options (#4497) 2016-04-25 15:54:02 +03:00
Nathan Cahill
1462f7e538 correct TileLayer constructors in debug (#4498) 2016-04-25 08:43:01 +02:00
Zsolt Ero
928100f961 Workaround for flyTo bug
* test for flyTo start latlng == end latlng condition
* workaround for flyTo infinite loop
* expect for zoomend values

Close #4226
2016-04-02 21:12:40 +02:00
Jan Pieter Waagmeester
0bed05d537 Use array in L.Control.Layers to preserve layer order fixes #2086 2016-04-02 20:48:31 +02:00
Per Liedman
4267291527 Initialize canvas dash on init. Check that canvas supports setLineDash.
Close #4363. Close #4351.
2016-04-02 09:41:59 +02:00
Iván Sánchez Ortega
6829134e90 Possible fix for #3530, also should fix some shaking on pinch-zooming. 2016-03-21 15:51:29 +01:00
Iván Sánchez Ortega
54f0f734ba Merge pull request #4206 from hyperknot/tile-debug
Tile debug
2016-02-15 15:17:01 +01:00
Yohan Boniface
50539d6fe5 Merge pull request #4131 from Leaflet/chrome-win10-dblclick
Possible fix for #4127, assume dblclick DOM event exists in touch-capable browsers
2016-02-15 11:18:42 +01:00
Zsolt Ero
7dd71b83f4 workaround flyTo bug 2016-02-12 03:14:12 +01:00
Zsolt Ero
3c87804f42 added gridLoadData 2016-02-12 02:12:05 +01:00
Zsolt Ero
68d52deada styling fixes 2016-02-09 00:00:04 +01:00
Zsolt Ero
a5506e9f8e added resetCounter, indenting for tile-debug 2016-02-08 23:22:59 +01:00