leaflet-rotate 0.1.1 → 0.1.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.
@@ -34,7 +34,7 @@ L.Control.Rotate = L.Control.extend({
34
34
  var link = this._link = L.DomUtil.create('a', 'leaflet-control-rotate-toggle', container);
35
35
  link.appendChild(arrow);
36
36
  link.href = '#';
37
- link.title = 'leaflet-control-rotate-toggle';
37
+ link.title = 'Rotate map';
38
38
 
39
39
  L.DomEvent
40
40
  .on(link, 'dblclick', L.DomEvent.stopPropagation)
@@ -145,7 +145,7 @@ L.Control.Rotate = L.Control.extend({
145
145
  }
146
146
  }
147
147
  } else {
148
- L.DomUtil.addClass(link, 'leaflet-disabled');
148
+ L.DomUtil.addClass(this._link, 'leaflet-disabled');
149
149
  }
150
150
  },
151
151
 
@@ -165,4 +165,4 @@ L.Map.addInitHook(function() {
165
165
  this.rotateControl = L.control.rotate(options);
166
166
  this.addControl(this.rotateControl);
167
167
  }
168
- });
168
+ });
@@ -42,4 +42,4 @@ L.extend(L.DomUtil, {
42
42
  DEG_TO_RAD: Math.PI / 180,
43
43
  RAD_TO_DEG: 180 / Math.PI,
44
44
 
45
- });
45
+ });
@@ -7,4 +7,4 @@ L.Draggable.include({
7
7
  this._mapBearing = mapBearing;
8
8
  },
9
9
 
10
- });
10
+ });
@@ -38,4 +38,4 @@ L.extend(L.Point.prototype, {
38
38
  );
39
39
  },
40
40
 
41
- });
41
+ });
@@ -85,7 +85,7 @@ L.Marker.include({
85
85
 
86
86
  _initInteraction: function() {
87
87
  var ret = markerProto._initInteraction.call(this);
88
- if (this.dragging && this._map && this._map._rotate) {
88
+ if (this.dragging && this.dragging.enabled() && this._map && this._map._rotate) {
89
89
  // L.Handler.MarkerDrag is used internally by L.Marker to make the markers draggable
90
90
  markerDragProto = markerDragProto || Object.getPrototypeOf(this.dragging);
91
91
  this.dragging._onDragStart = MarkerDrag._onDragStart.bind(this.dragging);
@@ -38,4 +38,4 @@ L.Map.CompassBearing = L.Handler.extend({
38
38
  // @section Handlers
39
39
  // @property compassBearing: Handler
40
40
  // Compass bearing handler.
41
- L.Map.addInitHook('addHandler', 'compassBearing', L.Map.CompassBearing);
41
+ L.Map.addInitHook('addHandler', 'compassBearing', L.Map.CompassBearing);
@@ -50,4 +50,4 @@ L.Map.ContainerMutation = L.Handler.extend({
50
50
  // @section Handlers
51
51
  // @property containerMutation: Handler
52
52
  // Container mutation handler (disabled unless [`trackContainerMutation`](#map-trackcontainermutation) is set).
53
- L.Map.addInitHook('addHandler', 'trackContainerMutation', L.Map.ContainerMutation);
53
+ L.Map.addInitHook('addHandler', 'trackContainerMutation', L.Map.ContainerMutation);
@@ -30,7 +30,7 @@ L.Map.ShiftKeyRotate = L.Handler.extend({
30
30
  if (e.shiftKey) {
31
31
  e.preventDefault();
32
32
  this._map.scrollWheelZoom.disable();
33
- this._map.setBearing((this._map._bearing * L.DomUtil.RAD_TO_DEG) + e.deltaY);
33
+ this._map.setBearing((this._map._bearing * L.DomUtil.RAD_TO_DEG) + Math.sign(e.deltaY) * 5);
34
34
  } else {
35
35
  this._map.scrollWheelZoom.enable();
36
36
  }
@@ -41,4 +41,12 @@ L.Map.ShiftKeyRotate = L.Handler.extend({
41
41
  // @section Handlers
42
42
  // @property touchZoom: Handler
43
43
  // Touch rotate handler.
44
- L.Map.addInitHook('addHandler', 'shiftKeyRotate', L.Map.ShiftKeyRotate);
44
+ L.Map.addInitHook('addHandler', 'shiftKeyRotate', L.Map.ShiftKeyRotate);
45
+
46
+ // decrease "scrollWheelZoom" handler priority over "shiftKeyRotate" handler
47
+ L.Map.addInitHook(function() {
48
+ if (this.scrollWheelZoom.enabled() && this.shiftKeyRotate.enabled()) {
49
+ this.scrollWheelZoom.disable();
50
+ this.scrollWheelZoom.enable();
51
+ }
52
+ });
@@ -1,3 +1 @@
1
- 'use strict';L.Map.mergeOptions({shiftKeyRotate:true});
2
- L.Map.ShiftKeyRotate=L.Handler.extend({addHooks:function(){L.DomEvent.on(this._map._container,"wheel",this._handleShiftScroll,this);this._map.shiftKeyRotate.rotate=true},removeHooks:function(){L.DomEvent.off(this._map._container,"wheel",this._handleShiftScroll,this);this._map.shiftKeyRotate.rotate=false},_handleShiftScroll:function(e){if(e.shiftKey){e.preventDefault();this._map.scrollWheelZoom.disable();this._map.setBearing(this._map._bearing*L.DomUtil.RAD_TO_DEG+e.deltaY)}else this._map.scrollWheelZoom.enable()}});
3
- L.Map.addInitHook("addHandler","shiftKeyRotate",L.Map.ShiftKeyRotate);
1
+ L.Map.mergeOptions({shiftKeyRotate:!0}),L.Map.ShiftKeyRotate=L.Handler.extend({addHooks:function(){L.DomEvent.on(this._map._container,"wheel",this._handleShiftScroll,this),this._map.shiftKeyRotate.rotate=!0},removeHooks:function(){L.DomEvent.off(this._map._container,"wheel",this._handleShiftScroll,this),this._map.shiftKeyRotate.rotate=!1},_handleShiftScroll:function(e){e.shiftKey?(e.preventDefault(),this._map.scrollWheelZoom.disable(),this._map.setBearing(this._map._bearing*L.DomUtil.RAD_TO_DEG+5*Math.sign(e.deltaY))):this._map.scrollWheelZoom.enable()}}),L.Map.addInitHook("addHandler","shiftKeyRotate",L.Map.ShiftKeyRotate),L.Map.addInitHook((function(){this.scrollWheelZoom.enabled()&&this.shiftKeyRotate.enabled()&&(this.scrollWheelZoom.disable(),this.scrollWheelZoom.enable())}));
@@ -159,4 +159,4 @@ L.Map.TouchGestures = L.Handler.extend({
159
159
  // @section Handlers
160
160
  // @property touchGestures: Handler
161
161
  // Touch gestures handler.
162
- L.Map.addInitHook('addHandler', 'touchGestures', L.Map.TouchGestures);
162
+ L.Map.addInitHook('addHandler', 'touchGestures', L.Map.TouchGestures);
@@ -29,4 +29,4 @@ L.Map.TouchRotate = L.Handler.extend({
29
29
  // @section Handlers
30
30
  // @property touchZoom: Handler
31
31
  // Touch rotate handler.
32
- L.Map.addInitHook('addHandler', 'touchRotate', L.Map.TouchRotate);
32
+ L.Map.addInitHook('addHandler', 'touchRotate', L.Map.TouchRotate);
@@ -35,4 +35,4 @@ L.Map.TouchZoom = L.Handler.extend({
35
35
  // @section Handlers
36
36
  // @property touchZoom: Handler
37
37
  // Touch zoom handler.
38
- L.Map.addInitHook('addHandler', 'touchZoom', L.Map.TouchZoom);
38
+ L.Map.addInitHook('addHandler', 'touchZoom', L.Map.TouchZoom);
@@ -1,125 +1,130 @@
1
- <!DOCTYPE html>
2
- <html>
3
-
4
- <head>
5
- <title>leaflet-rotate.js</title>
6
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
- <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
8
-
9
- <!-- Leaflet JS / CSS -->
10
- <script src="https://unpkg.com/leaflet@1.7/dist/leaflet-src.js"></script>
11
- <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7/dist/leaflet.css">
12
-
13
- <!-- Leaflet-Rotate -->
14
- <script src="../dist/leaflet-rotate-src.js"></script>
15
-
16
- <!-- include some miscellaneous -->
17
- <script src="../misc/route.js"></script>
18
- <script src="../misc/places.js"></script>
19
- <script src="../misc/loremIpsum.js"></script>
20
- <script src="../lib/debug.js"></script>
21
-
22
- <style>
23
- #map {
24
- width: 100%;
25
- height: 600px;
26
- border: 1px solid #ccc;
27
- max-height: 50vh;
28
- }
29
- </style>
30
- </head>
31
-
32
- <body>
33
-
34
- <div id="map"></div>
35
-
36
- <hr>
37
-
38
- <div>
39
- <p>
40
- <strong>Fly to bounds: </strong>
41
- <button onclick="map.flyToBounds(circle.getBounds());">CIRCLE</button>
42
- <button onclick="map.flyToBounds(polygon.getBounds());"> POLYGON</button>
43
- <button onclick="map.flyToBounds(path.getBounds());">PATH</button>
44
- </p>
45
- <p>
46
- <strong>Fly to: </strong>
47
- <button onclick="map.flyTo(places['Kyiv'], 10);">Kyiv</button>
48
- <button onclick="map.flyTo(places['London'], 10);">London</button>
49
- <button onclick="map.flyTo(places['San Francisco'], 10);">San Francisco</button>
50
- <button onclick="map.flyTo(places['Washington'], 10);">Washington</button>
51
- <button onclick="map.flyTo(places['Trondheim'], 10);">Trondheim</button>
52
- </p>
53
- </div>
54
-
55
- <script>
56
- var esri = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
57
- id: 'mapbox.streets',
58
- maxZoom: 24,
59
- maxNativeZoom: 18,
60
- attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
61
- });
62
-
63
- var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
64
- maxZoom: 24,
65
- maxNativeZoom: 19,
66
- attribution: '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
67
- });
68
-
69
- var map = L.map('map', {
70
- center: [55, 10],
71
- zoom: 2,
72
- layers: [esri],
73
- // worldCopyJump: true,
74
- rotate: true,
75
- touchRotate: true,
76
- rotateControl: {
77
- closeOnZeroBearing: false
78
- },
79
- bearing: 30,
80
- });
81
-
82
- // map.setBearing(30);
83
- // map.touchRotate.enable();
84
-
85
- var layers = L.control.layers({
86
- 'Empty': L.tileLayer(''),
87
- 'Streets': osm,
88
- 'Satellite': esri,
89
- }, null, {
90
- collapsed: false
91
- }).addTo(map);
92
-
93
- var markers = [];
94
- for (var i in places) {
95
- markers.push(L.marker(places[i], {
96
- draggable: true
97
- })
98
- .bindPopup('<b>' + i + '</b><br>' + loremIpsum)
99
- .bindTooltip('<b>' + i + '</b>', {direction: 'right', permanent: true})
100
- .addTo(map));
101
- }
102
-
103
- var path = L.polyline(route, {
104
- renderer: L.canvas()
105
- }).addTo(map);
106
-
107
- var circle = L.circle([53, 4], 111111)
108
- .addTo(map);
109
-
110
- var polygon = L.polygon([
111
- [48, -3],
112
- [50, -4],
113
- [52, 4]
114
- ]).addTo(map);
115
-
116
- // Display some debug info
117
- L.Rotate.debug(map);
118
- </script>
119
-
120
- <a href="https://github.com/Raruto/leaflet-rotate" class="view-on-github" style="position: fixed;bottom: 10px;left: calc(50% - 60px);z-index: 9999;"> <img alt="View on Github" src="https://raruto.github.io/img/view-on-github.png" title="View on Github"
121
- width="163"> </a>
122
-
123
- </body>
124
-
125
- </html>
1
+ <!DOCTYPE html>
2
+ <html>
3
+
4
+ <head>
5
+ <title>leaflet-rotate.js</title>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7
+ <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
8
+
9
+ <!-- Leaflet JS / CSS -->
10
+ <script src="https://unpkg.com/leaflet@1.7/dist/leaflet-src.js"></script>
11
+ <link rel="stylesheet" href="https://unpkg.com/leaflet@1.7/dist/leaflet.css">
12
+
13
+ <!-- Leaflet-Rotate -->
14
+ <script src="../dist/leaflet-rotate-src.js"></script>
15
+
16
+ <!-- include some miscellaneous -->
17
+ <script src="../misc/route.js"></script>
18
+ <script src="../misc/places.js"></script>
19
+ <script src="../misc/loremIpsum.js"></script>
20
+ <script src="../lib/debug.js"></script>
21
+
22
+ <style>
23
+ #map {
24
+ width: 100%;
25
+ height: 600px;
26
+ border: 1px solid #ccc;
27
+ max-height: 50vh;
28
+ }
29
+ </style>
30
+ </head>
31
+
32
+ <body>
33
+
34
+ <div id="map"></div>
35
+
36
+ <hr>
37
+
38
+ <div>
39
+ <p>
40
+ <strong>Fly to bounds: </strong>
41
+ <button onclick="map.flyToBounds(circle.getBounds());">CIRCLE</button>
42
+ <button onclick="map.flyToBounds(polygon.getBounds());"> POLYGON</button>
43
+ <button onclick="map.flyToBounds(path.getBounds());">PATH</button>
44
+ </p>
45
+ <p>
46
+ <strong>Fly to: </strong>
47
+ <button onclick="map.flyTo(places['Kyiv'], 10);">Kyiv</button>
48
+ <button onclick="map.flyTo(places['London'], 10);">London</button>
49
+ <button onclick="map.flyTo(places['San Francisco'], 10);">San Francisco</button>
50
+ <button onclick="map.flyTo(places['Washington'], 10);">Washington</button>
51
+ <button onclick="map.flyTo(places['Trondheim'], 10);">Trondheim</button>
52
+ </p>
53
+ </div>
54
+
55
+ <script>
56
+ var esri = L.tileLayer('https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer/tile/{z}/{y}/{x}', {
57
+ id: 'mapbox.streets',
58
+ maxZoom: 24,
59
+ maxNativeZoom: 18,
60
+ attribution: 'Tiles &copy; Esri &mdash; Source: Esri, i-cubed, USDA, USGS, AEX, GeoEye, Getmapping, Aerogrid, IGN, IGP, UPR-EGP, and the GIS User Community',
61
+ });
62
+
63
+ var osm = L.tileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
64
+ maxZoom: 24,
65
+ maxNativeZoom: 19,
66
+ attribution: '&copy; <a href="http://openstreetmap.org/copyright">OpenStreetMap</a> contributors',
67
+ });
68
+
69
+ var map = L.map('map', {
70
+ center: [55, 10],
71
+ zoom: 2,
72
+ layers: [esri],
73
+ // worldCopyJump: true,
74
+ rotate: true,
75
+ touchRotate: true,
76
+ rotateControl: {
77
+ closeOnZeroBearing: false
78
+ },
79
+ bearing: 30,
80
+ });
81
+
82
+ // map.setBearing(30);
83
+ // map.touchRotate.enable();
84
+
85
+ var layers = L.control.layers({
86
+ 'Empty': L.tileLayer(''),
87
+ 'Streets': osm,
88
+ 'Satellite': esri,
89
+ }, null, {
90
+ collapsed: false
91
+ }).addTo(map);
92
+
93
+ var markers = [];
94
+ for (var i in places) {
95
+ markers.push(L.marker(places[i], {
96
+ draggable: true
97
+ })
98
+ .bindPopup('<b>' + i + '</b><br>' + loremIpsum)
99
+ .bindTooltip('<b>' + i + '</b>',
100
+ markers.length ? {} : {
101
+ direction: 'right',
102
+ permanent: true
103
+ }
104
+ )
105
+ .addTo(map));
106
+ }
107
+
108
+ var path = L.polyline(route, {
109
+ renderer: L.canvas()
110
+ }).addTo(map);
111
+
112
+ var circle = L.circle([53, 4], 111111)
113
+ .addTo(map);
114
+
115
+ var polygon = L.polygon([
116
+ [48, -3],
117
+ [50, -4],
118
+ [52, 4]
119
+ ]).addTo(map);
120
+
121
+ // Display some debug info
122
+ L.Rotate.debug(map);
123
+ </script>
124
+
125
+ <a href="https://github.com/Raruto/leaflet-rotate" class="view-on-github" style="position: fixed;bottom: 10px;left: calc(50% - 60px);z-index: 9999;"> <img alt="View on Github" src="https://raruto.github.io/img/view-on-github.png" title="View on Github"
126
+ width="163"> </a>
127
+
128
+ </body>
129
+
130
+ </html>
@@ -1,3 +0,0 @@
1
- 'use strict';const domUtilProto=L.extend({},L.DomUtil);
2
- L.extend(L.DomUtil,{setTransform:function(el,offset,scale,bearing,pivot){var pos=offset||new L.Point(0,0);if(!bearing){offset=pos._round();return domUtilProto.setTransform.call(this,el,offset,scale)}pos=pos.rotateFrom(bearing,pivot);el.style[L.DomUtil.TRANSFORM]="translate3d("+pos.x+"px,"+pos.y+"px"+",0)"+(scale?" scale("+scale+")":"")+" rotate("+bearing+"rad)"},setPosition:function(el,point,bearing,pivot){if(!bearing)return domUtilProto.setPosition.call(this,el,point);el._leaflet_pos=point;if(L.Browser.any3d)L.DomUtil.setTransform(el,
3
- point,undefined,bearing,pivot);else{el.style.left=point.x+"px";el.style.top=point.y+"px"}},DEG_TO_RAD:Math.PI/180,RAD_TO_DEG:180/Math.PI});
package/src/index.min.js DELETED
@@ -1,2 +0,0 @@
1
- 'use strict';export*from"./dom/DomUtil";export*from"./dom/Draggable";export*from"./geometry/Point";export*from"./layer/DivOverlay";export*from"./layer/Popup";export*from"./layer/Tooltip";export*from"./layer/marker/Icon";export*from"./layer/marker/Marker";export*from"./layer/tile/GridLayer";export*from"./layer/vector/Canvas";export*from"./layer/vector/Renderer";export*from"./layer/vector/SVG";export*from"./map/Map";export*from"./map/handler/CompassBearing";export*from"./map/handler/ContainerMutation";
2
- export*from"./map/handler/TouchGestures";export*from"./map/handler/TouchRotate";export*from"./map/handler/ShiftKeyRotate";export*from"./map/handler/TouchZoom";export*from"./control/Rotate";
@@ -1,3 +0,0 @@
1
- 'use strict';const divOverlayProto=L.extend({},L.DivOverlay.prototype);
2
- L.DivOverlay.include({getEvents:function(){return L.extend(divOverlayProto.getEvents.call(this),{rotate:this._updatePosition})},_updatePosition:function(){if(!this._map)return;var pos=this._map.latLngToLayerPoint(this._latlng),offset=L.point(this.options.offset),anchor=this._getAnchor();if(this._zoomAnimated){if(this._map._rotate)pos=this._map.rotatedPointToMapPanePoint(pos);L.DomUtil.setPosition(this._container,pos.add(anchor))}else offset=offset.add(pos).add(anchor);var bottom=this._containerBottom=
3
- -offset.y,left=this._containerLeft=-Math.round(this._containerWidth/2)+offset.x;this._container.style.bottom=bottom+"px";this._container.style.left=left+"px"}});
@@ -1,4 +0,0 @@
1
- 'use strict';const popupProto=L.extend({},L.Popup.prototype);
2
- L.Popup.include({_animateZoom:function(e){if(!this._map._rotate)popupProto._animateZoom.call(this,e);var pos=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center),anchor=this._getAnchor();pos=this._map.rotatedPointToMapPanePoint(pos);L.DomUtil.setPosition(this._container,pos.add(anchor))},_adjustPan:function(){if(!this.options.autoPan||this._map._panAnim&&this._map._panAnim._inProgress)return;var map=this._map,marginBottom=parseInt(L.DomUtil.getStyle(this._container,"marginBottom"),10)||
3
- 0,containerHeight=this._container.offsetHeight+marginBottom,containerWidth=this._containerWidth,layerPos=new L.Point(this._containerLeft,-containerHeight-this._containerBottom);layerPos._add(L.DomUtil.getPosition(this._container));var containerPos=layerPos._add(this._map._getMapPanePos()),padding=L.point(this.options.autoPanPadding),paddingTL=L.point(this.options.autoPanPaddingTopLeft||padding),paddingBR=L.point(this.options.autoPanPaddingBottomRight||padding),size=map.getSize(),dx=0,dy=0;if(containerPos.x+
4
- containerWidth+paddingBR.x>size.x)dx=containerPos.x+containerWidth-size.x+paddingBR.x;if(containerPos.x-dx-paddingTL.x<0)dx=containerPos.x-paddingTL.x;if(containerPos.y+containerHeight+paddingBR.y>size.y)dy=containerPos.y+containerHeight-size.y+paddingBR.y;if(containerPos.y-dy-paddingTL.y<0)dy=containerPos.y-paddingTL.y;if(dx||dy)map.fire("autopanstart").panBy([dx,dy])}});
@@ -1,2 +0,0 @@
1
- 'use strict';const tooltipProto=L.extend({},L.Tooltip.prototype);
2
- L.Tooltip.include({_updatePosition:function(){if(!this._map._rotate)return tooltipProto._updatePosition.call(this);var pos=this._map.latLngToLayerPoint(this._latlng);pos=this._map.rotatedPointToMapPanePoint(pos);this._setPosition(pos)},_animateZoom:function(e){if(!this._map._rotate)return tooltipProto._animateZoom.call(this,e);var pos=this._map._latLngToNewLayerPoint(this._latlng,e.zoom,e.center);pos=this._map.rotatedPointToMapPanePoint(pos);this._setPosition(pos)}});
@@ -1,3 +0,0 @@
1
- 'use strict';const iconProto=L.extend({},L.Icon.prototype);
2
- L.Icon.include({_setIconStyles:function(img,name){var options=this.options;var sizeOption=options[name+"Size"];if(typeof sizeOption==="number")sizeOption=[sizeOption,sizeOption];var size=L.point(sizeOption),anchor=L.point(name==="shadow"&&options.shadowAnchor||options.iconAnchor||size&&size.divideBy(2,true));img.className="leaflet-marker-"+name+" "+(options.className||"");if(anchor){img.style.marginLeft=-anchor.x+"px";img.style.marginTop=-anchor.y+"px";img.style[L.DomUtil.TRANSFORM+"Origin"]=anchor.x+
3
- "px "+anchor.y+"px 0px"}if(size){img.style.width=size.x+"px";img.style.height=size.y+"px"}}});
@@ -1,6 +0,0 @@
1
- 'use strict';var markerDragProto;
2
- var MarkerDrag={_onDragStart:function(){if(!this._marker._map._rotate)return markerDragProto._onDragStart.call(this);this._draggable.updateMapBearing(this._marker._map._bearing)},_onDrag:function(e){var marker=this._marker,rotated_marker=marker.options.rotation||marker.options.rotateWithView,shadow=marker._shadow,iconPos=L.DomUtil.getPosition(marker._icon);if(!rotated_marker&&shadow)L.DomUtil.setPosition(shadow,iconPos);if(marker._map._rotate)iconPos=marker._map.mapPanePointToRotatedPoint(iconPos);var latlng=
3
- marker._map.layerPointToLatLng(iconPos);marker._latlng=latlng;e.latlng=latlng;e.oldLatLng=this._oldLatLng;if(rotated_marker)marker.setLatLng(latlng);else marker.fire("move",e);marker.fire("drag",e)},_onDragEnd:function(e){if(this._marker._map._rotate)this._marker.update();markerDragProto._onDragEnd.call(this,e)}};const markerProto=L.extend({},L.Marker.prototype);L.Marker.mergeOptions({rotation:0,rotateWithView:false});
4
- L.Marker.include({getEvents:function(){return L.extend(markerProto.getEvents.call(this),{rotate:this.update})},onAdd:function(map){markerProto.onAdd.call(this,map);map.on("rotate",this.update,this)},_initInteraction:function(){var ret=markerProto._initInteraction.call(this);if(this.dragging&&this._map&&this._map._rotate){markerDragProto=markerDragProto||Object.getPrototypeOf(this.dragging);this.dragging._onDragStart=MarkerDrag._onDragStart.bind(this.dragging);this.dragging._onDrag=MarkerDrag._onDrag.bind(this.dragging);
5
- this.dragging._onDragEnd=MarkerDrag._onDragEnd.bind(this.dragging);this.dragging.disable();this.dragging.enable()}return ret},_setPos:function(pos){if(this._map._rotate)pos=this._map.rotatedPointToMapPanePoint(pos);var bearing=this.options.rotation||0;if(this.options.rotateWithView)bearing+=this._map._bearing;L.DomUtil.setPosition(this._icon,pos,bearing,pos);if(this._shadow)L.DomUtil.setPosition(this._shadow,pos,bearing,pos);this._zIndex=pos.y+this.options.zIndexOffset;this._resetZIndex()},_updateZIndex:function(offset){if(!this._map._rotate)return markerProto._updateZIndex.call(this,
6
- offset);this._icon.style.zIndex=Math.round(this._zIndex+offset)},setRotation:function(rotation){this.options.rotation=rotation;this.update()}});
@@ -1,3 +0,0 @@
1
- 'use strict';const gridLayerProto=L.extend({},L.GridLayer.prototype);
2
- L.GridLayer.include({getEvents:function(){var events=gridLayerProto.getEvents.call(this);if(this._map._rotate&&!this.options.updateWhenIdle){if(!this._onRotate)this._onRotate=L.Util.throttle(this._onMoveEnd,this.options.updateInterval,this);events.rotate=this._onRotate}return events},_getTiledPixelBounds:function(center){if(!this._map._rotate)return gridLayerProto._getTiledPixelBounds.call(this,center);var map=this._map,mapZoom=map._animatingZoom?Math.max(map._animateToZoom,map.getZoom()):map.getZoom(),
3
- scale=map.getZoomScale(mapZoom,this._tileZoom),pixelCenter=map.project(center,this._tileZoom).floor(),size=map.getSize(),halfSize=(new L.Bounds([map.containerPointToLayerPoint([0,0]).floor(),map.containerPointToLayerPoint([size.x,0]).floor(),map.containerPointToLayerPoint([0,size.y]).floor(),map.containerPointToLayerPoint([size.x,size.y]).floor()])).getSize().divideBy(scale*2);return new L.Bounds(pixelCenter.subtract(halfSize),pixelCenter.add(halfSize))}});
@@ -1 +0,0 @@
1
- 'use strict';const canvasProto=L.extend({},L.Canvas.prototype);L.Canvas.include({onAdd:function(){canvasProto.onAdd.call(this);this._map.on("rotate",this._redraw,this)},onRemove:function(){canvasProto.onRemove.call(this);this._map.off("rotate",this._redraw,this)},_update:function(){canvasProto._update.call(this);this.fire("update")}});
@@ -1,3 +0,0 @@
1
- 'use strict';const rendererProto=L.extend({},L.Renderer.prototype);
2
- L.Renderer.include({onAdd:function(){rendererProto.onAdd.call(this)},onRemove:function(){rendererProto.onRemove.call(this)},_updateTransform:function(center,zoom){if(!this._map._rotate)return rendererProto._updateTransform.call(this,center,zoom);var scale=this._map.getZoomScale(zoom,this._zoom),offset=this._map._latLngToNewLayerPoint(this._topLeft,zoom,center);if(L.Browser.any3d)L.DomUtil.setTransform(this._container,offset,scale);else L.DomUtil.setPosition(this._container,offset)},_update:function(){if(!this._map._rotate)return rendererProto._update.call(this);
3
- var p=this.options.padding,map=this._map,size=this._map.getSize(),padMin=size.multiplyBy(-p),padMax=size.multiplyBy(1+p),clip=new L.Bounds([map.containerPointToLayerPoint([padMin.x,padMin.y]).floor(),map.containerPointToLayerPoint([padMin.x,padMax.y]).floor(),map.containerPointToLayerPoint([padMax.x,padMin.y]).floor(),map.containerPointToLayerPoint([padMax.x,padMax.y]).floor()]);this._bounds=clip;this._topLeft=this._map.layerPointToLatLng(clip.min);this._center=this._map.getCenter();this._zoom=this._map.getZoom()}});
@@ -1 +0,0 @@
1
- 'use strict';const svgProto=L.extend({},L.SVG.prototype);L.SVG.include({_update:function(){svgProto._update.call(this);if(this._map._rotate)this.fire("update")}});
@@ -1,9 +0,0 @@
1
- 'use strict';const mapProto=L.extend({},L.Map.prototype);L.Map.mergeOptions({rotate:false,bearing:0});
2
- L.Map.include({initialize:function(id,options){if(options.rotate){this._rotate=true;this._bearing=0}mapProto.initialize.call(this,id,options);if(this.options.rotate)this.setBearing(this.options.bearing)},containerPointToLayerPoint:function(point){if(!this._rotate)return mapProto.containerPointToLayerPoint.call(this,point);return L.point(point).subtract(this._getMapPanePos()).rotateFrom(-this._bearing,this._getRotatePanePos()).subtract(this._getRotatePanePos())},getBounds:function(){if(!this._rotate)return mapProto.getBounds.call(this);
3
- var size=this.getSize();var topleft=this.layerPointToLatLng(this.containerPointToLayerPoint([0,0])),topright=this.layerPointToLatLng(this.containerPointToLayerPoint([size.x,0])),bottomright=this.layerPointToLatLng(this.containerPointToLayerPoint([size.x,size.y])),bottomleft=this.layerPointToLatLng(this.containerPointToLayerPoint([0,size.y]));return new L.LatLngBounds([topleft,topright,bottomright,bottomleft])},layerPointToContainerPoint:function(point){if(!this._rotate)return mapProto.layerPointToContainerPoint.call(this,
4
- point);return L.point(point).add(this._getRotatePanePos()).rotateFrom(this._bearing,this._getRotatePanePos()).add(this._getMapPanePos())},setBearing:function(theta){if(!L.Browser.any3d||!this._rotate)return;var rotatePanePos=this._getRotatePanePos();var halfSize=this.getSize().divideBy(2);this._pivot=this._getMapPanePos().clone().multiplyBy(-1).add(halfSize);rotatePanePos=rotatePanePos.rotateFrom(-this._bearing,this._pivot);this._bearing=theta*L.DomUtil.DEG_TO_RAD;this._rotatePanePos=rotatePanePos.rotateFrom(this._bearing,
5
- this._pivot);L.DomUtil.setPosition(this._rotatePane,rotatePanePos,this._bearing,this._pivot);this.fire("rotate")},getBearing:function(){return this._bearing*L.DomUtil.RAD_TO_DEG},_initPanes:function(){var panes=this._panes={};this._paneRenderers={};this._mapPane=this.createPane("mapPane",this._container);L.DomUtil.setPosition(this._mapPane,new L.Point(0,0));if(this._rotate){this._rotatePane=this.createPane("rotatePane",this._mapPane);this._norotatePane=this.createPane("norotatePane",this._mapPane);
6
- this.createPane("tilePane",this._rotatePane);this.createPane("overlayPane",this._rotatePane);this.createPane("shadowPane",this._norotatePane);this.createPane("markerPane",this._norotatePane);this.createPane("tooltipPane",this._norotatePane);this.createPane("popupPane",this._norotatePane)}else{this.createPane("tilePane");this.createPane("overlayPane");this.createPane("shadowPane");this.createPane("markerPane");this.createPane("tooltipPane");this.createPane("popupPane")}if(!this.options.markerZoomAnimation){L.DomUtil.addClass(panes.markerPane,
7
- "leaflet-zoom-hide");L.DomUtil.addClass(panes.shadowPane,"leaflet-zoom-hide")}},rotatedPointToMapPanePoint:function(point){return L.point(point).rotate(this._bearing)._add(this._getRotatePanePos())},mapPanePointToRotatedPoint:function(point){return L.point(point)._subtract(this._getRotatePanePos()).rotate(-this._bearing)},_getCenterOffset:function(latlng){var centerOffset=mapProto._getCenterOffset.call(this,latlng);if(this._rotate)centerOffset=centerOffset.rotate(this._bearing);return centerOffset},
8
- _getRotatePanePos:function(){return this._rotatePanePos||new L.Point(0,0)},_getNewPixelOrigin:function(center,zoom){var viewHalf=this.getSize()._divideBy(2);if(!this._rotate)mapProto._getNewPixelOrigin.call(this,center,zoom);return this.project(center,zoom).rotate(this._bearing)._subtract(viewHalf)._add(this._getMapPanePos())._add(this._getRotatePanePos()).rotate(-this._bearing)._round()},_handleGeolocationResponse:function(pos){var lat=pos.coords.latitude,lng=pos.coords.longitude,hdg=pos.coords.heading,
9
- latlng=new L.LatLng(lat,lng),bounds=latlng.toBounds(pos.coords.accuracy),options=this._locateOptions;if(options.setView){var zoom=this.getBoundsZoom(bounds);this.setView(latlng,options.maxZoom?Math.min(zoom,options.maxZoom):zoom)}var data={latlng:latlng,bounds:bounds,timestamp:pos.timestamp,heading:hdg};for(var i in pos.coords)if(typeof pos.coords[i]==="number")data[i]=pos.coords[i];this.fire("locationfound",data)}});