leaflet-rotate 0.5.3 → 0.5.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/leaflet-rotate-src.js +21 -7
- package/dist/leaflet-rotate-src.js.map +2 -2
- package/dist/leaflet-rotate.js +1 -1
- package/dist/leaflet-rotate.js.map +3 -3
- package/lib/debug.js +3 -0
- package/lib/debug.min.js +1 -1
- package/package.json +1 -1
- package/src/dom/Draggable.js +20 -8
- package/src/map/Map.js +6 -4
- package/test/features/example.feature +5 -0
- package/test/features/harness.feature +84 -0
- package/test/features/overlays.feature +16 -0
- package/test/index.html +20 -5
- package/test/steps/example.steps.js +18 -0
- package/test/steps/harness.steps.js +207 -0
- package/test/steps/overlays.steps.js +142 -0
- package/test/support/hooks.js +1 -1
package/README.md
CHANGED
|
@@ -26,7 +26,7 @@ Load Leaflet first, then the plugin. For example, using the published CDN build:
|
|
|
26
26
|
```html
|
|
27
27
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@1.9/dist/leaflet.css">
|
|
28
28
|
<script src="https://unpkg.com/leaflet@1.9/dist/leaflet.js"></script>
|
|
29
|
-
<script src="https://unpkg.com/leaflet-rotate@0.5.
|
|
29
|
+
<script src="https://unpkg.com/leaflet-rotate@0.5.4/dist/leaflet-rotate.js"></script>
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
Or if you want to test it with [`2.0.0-alpha.1`](https://github.com/Leaflet/Leaflet/releases/tag/v2.0.0-alpha.1):
|
|
@@ -35,7 +35,7 @@ Or if you want to test it with [`2.0.0-alpha.1`](https://github.com/Leaflet/Leaf
|
|
|
35
35
|
<link rel="stylesheet" href="https://unpkg.com/leaflet@2.0.0-alpha.1/dist/leaflet.css">
|
|
36
36
|
<script src="https://unpkg.com/leaflet@2.0.0-alpha.1/dist/leaflet-global-src.js"></script>
|
|
37
37
|
<script>globalThis.L = globalThis.leaflet;</script>
|
|
38
|
-
<script src="https://unpkg.com/leaflet-rotate@0.5.
|
|
38
|
+
<script src="https://unpkg.com/leaflet-rotate@0.5.4/dist/leaflet-rotate.js"></script>
|
|
39
39
|
```
|
|
40
40
|
|
|
41
41
|
Now, you can enable rotation in the map options. Bearing and pitch values are in degrees:
|
|
@@ -84,11 +84,25 @@ var leafletRotate = (() => {
|
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
// src/dom/Draggable.js
|
|
87
|
+
var draggableProto = Object.defineProperties({}, Object.getOwnPropertyDescriptors(L.Draggable.prototype));
|
|
87
88
|
L.Draggable.include({
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
_onMove(e) {
|
|
90
|
+
const pointer = e.touches ? e.touches[0] : e;
|
|
91
|
+
if (this._enabled && this._moving && (!e.touches || e.touches.length === 1)) {
|
|
92
|
+
const offset = new L.Point(pointer.clientX, pointer.clientY).subtract(this._startPoint);
|
|
93
|
+
if (!offset.x && !offset.y || Math.abs(offset.x) + Math.abs(offset.y) < this.options.clickTolerance) {
|
|
94
|
+
L.DomEvent.preventDefault(e);
|
|
95
|
+
this._newPos = this._startPos.add(new L.Point(
|
|
96
|
+
offset.x / this._parentScale.x,
|
|
97
|
+
offset.y / this._parentScale.y
|
|
98
|
+
));
|
|
99
|
+
this._lastEvent = e;
|
|
100
|
+
this._updatePosition();
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
return draggableProto._onMove.apply(this, arguments);
|
|
105
|
+
}
|
|
92
106
|
});
|
|
93
107
|
|
|
94
108
|
// src/geometry/Point.js
|
|
@@ -1577,7 +1591,7 @@ var leafletRotate = (() => {
|
|
|
1577
1591
|
* @since leaflet-rotate (v0.1.4)
|
|
1578
1592
|
*/
|
|
1579
1593
|
panInside(latlng, options) {
|
|
1580
|
-
if (!this._rotate
|
|
1594
|
+
if (!this._rotate) {
|
|
1581
1595
|
return mapProto.panInside.apply(this, arguments);
|
|
1582
1596
|
}
|
|
1583
1597
|
options = options || {};
|
|
@@ -1758,7 +1772,7 @@ var leafletRotate = (() => {
|
|
|
1758
1772
|
const center = this.getSize().divideBy(2), layerCenter = this.containerPointToLayerPoint(center), opposite = layerCenter.multiplyBy(2).subtract(this.project(latlng).subtract(this._pixelOrigin));
|
|
1759
1773
|
return center.subtract(this.layerPointToContainerPoint(opposite));
|
|
1760
1774
|
}
|
|
1761
|
-
return this.
|
|
1775
|
+
return this.layerPointToContainerPoint(this.project(latlng).subtract(this._pixelOrigin))._subtract(this.getSize()._divideBy(2));
|
|
1762
1776
|
},
|
|
1763
1777
|
/**
|
|
1764
1778
|
* Return the current position of the rotated pane.
|
|
@@ -1788,7 +1802,7 @@ var leafletRotate = (() => {
|
|
|
1788
1802
|
if (!this._rotate) {
|
|
1789
1803
|
return mapProto._getNewPixelOrigin.apply(this, arguments);
|
|
1790
1804
|
}
|
|
1791
|
-
return this.project(center, zoom)._subtract(this.containerPointToLayerPoint(this.getSize()._divideBy(2)))
|
|
1805
|
+
return this.project(center, zoom)._subtract(this.containerPointToLayerPoint(this.getSize()._divideBy(2)));
|
|
1792
1806
|
},
|
|
1793
1807
|
/**
|
|
1794
1808
|
* Calculate the pixel bounds needed to cover the transformed viewport.
|