leaflet-rotate 0.2.1 → 0.2.2
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/dist/leaflet-rotate-src.js +198 -156
- package/dist/leaflet-rotate-src.js.map +1 -1
- package/dist/leaflet-rotate.js +198 -156
- package/dist/leaflet-rotate.js.map +1 -1
- package/package.json +1 -1
- package/src/dom/DomUtil.js +32 -2
- package/src/dom/Draggable.js +7 -0
- package/src/geo/LatLngBounds.js +13 -0
- package/src/geometry/Bounds.js +13 -0
- package/src/geometry/Point.js +5 -0
- package/src/index.js +16 -3
- package/src/layer/DivOverlay.js +11 -4
- package/src/layer/Popup.js +6 -6
- package/src/layer/marker/Marker.js +29 -17
- package/src/layer/tile/GridLayer.js +6 -0
- package/src/layer/vector/Renderer.js +9 -9
- package/src/map/handler/CompassBearing.js +5 -3
- package/src/map/handler/ContainerMutation.js +23 -24
- package/src/map/handler/ShiftKeyRotate.js +11 -10
- package/src/map/handler/TouchGestures.js +20 -10
- package/src/map/handler/TouchRotate.js +10 -8
- package/src/map/handler/TouchZoom.js +24 -15
- package/src/layer/vector/Canvas.js +0 -28
- package/src/layer/vector/SVG.js +0 -18
package/dist/leaflet-rotate.js
CHANGED
|
@@ -13,6 +13,18 @@
|
|
|
13
13
|
|
|
14
14
|
L.extend(L.DomUtil, {
|
|
15
15
|
|
|
16
|
+
/**
|
|
17
|
+
* Resets the 3D CSS transform of `el` so it is
|
|
18
|
+
* translated by `offset` pixels and optionally
|
|
19
|
+
* scaled by `scale`. Does not have an effect if
|
|
20
|
+
* the browser doesn't support 3D CSS transforms.
|
|
21
|
+
*
|
|
22
|
+
* @param {HTMLElement} el
|
|
23
|
+
* @param {L.Point} offset
|
|
24
|
+
* @param {Number} scale
|
|
25
|
+
* @param {Number} bearing
|
|
26
|
+
* @param {L.Point} pivot
|
|
27
|
+
*/
|
|
16
28
|
setTransform: function(el, offset, scale, bearing, pivot) {
|
|
17
29
|
var pos = offset || new L.Point(0, 0);
|
|
18
30
|
|
|
@@ -29,7 +41,19 @@
|
|
|
29
41
|
' rotate(' + bearing + 'rad)';
|
|
30
42
|
},
|
|
31
43
|
|
|
32
|
-
|
|
44
|
+
/**
|
|
45
|
+
* Sets the position of `el` to coordinates specified by
|
|
46
|
+
* `position`, using CSS translate or top/left positioning
|
|
47
|
+
* depending on the browser (used by Leaflet internally
|
|
48
|
+
* to position its layers).
|
|
49
|
+
*
|
|
50
|
+
* @param {HTMLElement} el
|
|
51
|
+
* @param {L.Point} point
|
|
52
|
+
* @param {Number} bearing
|
|
53
|
+
* @param {L.Point} pivot
|
|
54
|
+
* @param {Number} scale
|
|
55
|
+
*/
|
|
56
|
+
setPosition: function(el, point, bearing, pivot, scale) {
|
|
33
57
|
if (!bearing) {
|
|
34
58
|
return domUtilProto.setPosition.apply(this, arguments);
|
|
35
59
|
}
|
|
@@ -46,8 +70,14 @@
|
|
|
46
70
|
}
|
|
47
71
|
},
|
|
48
72
|
|
|
49
|
-
|
|
73
|
+
/**
|
|
74
|
+
* @constant radians = degrees × π/180°
|
|
75
|
+
*/
|
|
50
76
|
DEG_TO_RAD: Math.PI / 180,
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* @constant degrees = radians × 180°/π
|
|
80
|
+
*/
|
|
51
81
|
RAD_TO_DEG: 180 / Math.PI,
|
|
52
82
|
|
|
53
83
|
});
|
|
@@ -58,8 +88,15 @@
|
|
|
58
88
|
* @see https://github.com/Leaflet/Leaflet/tree/v1.9.3/src/dom/Draggable.js
|
|
59
89
|
*/
|
|
60
90
|
|
|
91
|
+
/**
|
|
92
|
+
* A class for making DOM elements draggable (including touch support).
|
|
93
|
+
* Used internally for map and marker dragging. Only works for elements
|
|
94
|
+
* that were positioned with [`L.DomUtil.setPosition`](#domutil-setposition).
|
|
95
|
+
*/
|
|
96
|
+
|
|
61
97
|
L.Draggable.include({
|
|
62
98
|
|
|
99
|
+
/** @TODO */
|
|
63
100
|
// updateMapBearing: function(mapBearing) {
|
|
64
101
|
// this._mapBearing = mapBearing;
|
|
65
102
|
// },
|
|
@@ -94,6 +131,11 @@
|
|
|
94
131
|
* 3. add (pivot.x, pivot.y) back
|
|
95
132
|
*
|
|
96
133
|
* same as `this.subtract(pivot).rotate(theta).add(pivot)`
|
|
134
|
+
*
|
|
135
|
+
* @param {Number} theta
|
|
136
|
+
* @param {L.Point} pivot
|
|
137
|
+
*
|
|
138
|
+
* @returns {L.Point}
|
|
97
139
|
*/
|
|
98
140
|
rotateFrom: function(theta, pivot) {
|
|
99
141
|
if (!theta) { return this; }
|
|
@@ -122,16 +164,23 @@
|
|
|
122
164
|
|
|
123
165
|
L.DivOverlay.include({
|
|
124
166
|
|
|
167
|
+
/**
|
|
168
|
+
* Update L.Popup and L.Tooltip anchor positions after
|
|
169
|
+
* the map is moved by calling `map.setBearing(theta)`
|
|
170
|
+
*
|
|
171
|
+
* @listens L.Map~rotate
|
|
172
|
+
*/
|
|
125
173
|
getEvents: function() {
|
|
126
174
|
return L.extend(divOverlayProto.getEvents.apply(this, arguments), { rotate: this._updatePosition });
|
|
127
175
|
},
|
|
128
176
|
|
|
177
|
+
/**
|
|
178
|
+
* 0. update element anchor point (divOverlayProto v1.9.3)
|
|
179
|
+
* 1. rotate around anchor point (subtract anchor -> rotate point -> add anchor)
|
|
180
|
+
*/
|
|
129
181
|
_updatePosition: function() {
|
|
130
|
-
|
|
182
|
+
if (!this._map) { return; }
|
|
131
183
|
divOverlayProto._updatePosition.apply(this, arguments);
|
|
132
|
-
// 1. subtract anchor
|
|
133
|
-
// 2. rotate element
|
|
134
|
-
// 3. restore anchor
|
|
135
184
|
if (this._map && this._map._rotate && this._zoomAnimated) {
|
|
136
185
|
var anchor = this._getAnchor();
|
|
137
186
|
var pos = L.DomUtil.getPosition(this._container).subtract(anchor);
|
|
@@ -152,12 +201,12 @@
|
|
|
152
201
|
|
|
153
202
|
L.Popup.include({
|
|
154
203
|
|
|
204
|
+
/**
|
|
205
|
+
* 0. update element anchor point (popupProto v1.9.3)
|
|
206
|
+
* 1. rotate around anchor point (subtract anchor -> rotate point -> add anchor)
|
|
207
|
+
*/
|
|
155
208
|
_animateZoom: function(e) {
|
|
156
|
-
// 0. update anchor (leaflet v1.9.3)
|
|
157
209
|
popupProto._animateZoom.apply(this, arguments);
|
|
158
|
-
// 1. subtract anchor
|
|
159
|
-
// 2. rotate element
|
|
160
|
-
// 3. restore anchor
|
|
161
210
|
if (this._map && this._map._rotate) {
|
|
162
211
|
var anchor = this._getAnchor();
|
|
163
212
|
var pos = L.DomUtil.getPosition(this._container).subtract(anchor);
|
|
@@ -166,7 +215,7 @@
|
|
|
166
215
|
},
|
|
167
216
|
|
|
168
217
|
/**
|
|
169
|
-
*
|
|
218
|
+
* Fix for L.popup({ keepInView = true })
|
|
170
219
|
*
|
|
171
220
|
* @see https://github.com/fnicollet/Leaflet/pull/21
|
|
172
221
|
*/
|
|
@@ -188,8 +237,8 @@
|
|
|
188
237
|
|
|
189
238
|
layerPos._add(L.DomUtil.getPosition(this._container));
|
|
190
239
|
|
|
191
|
-
// var containerPos = map.layerPointToContainerPoint(layerPos);
|
|
192
240
|
/** @TODO use popupProto._adjustPan */
|
|
241
|
+
// var containerPos = map.layerPointToContainerPoint(layerPos);
|
|
193
242
|
var containerPos = layerPos._add(this._map._getMapPanePos()),
|
|
194
243
|
padding = L.point(this.options.autoPanPadding),
|
|
195
244
|
paddingTL = L.point(this.options.autoPanPaddingTopLeft || padding),
|
|
@@ -304,22 +353,33 @@
|
|
|
304
353
|
* @external L.Handler.MarkerDrag
|
|
305
354
|
*
|
|
306
355
|
* @see https://github.com/Leaflet/Leaflet/tree/v1.9.3/src/layer/marker/Marker.js
|
|
356
|
+
* @see https://github.com/Leaflet/Leaflet/tree/v1.9.3/src/layer/marker/Marker.Drag.js
|
|
357
|
+
* @see https://github.com/Leaflet/Leaflet/tree/v1.9.3/src/dom/Draggable.js
|
|
307
358
|
*/
|
|
308
359
|
|
|
309
360
|
const markerProto = L.extend({}, L.Marker.prototype);
|
|
310
361
|
|
|
311
362
|
L.Marker.mergeOptions({
|
|
312
363
|
|
|
313
|
-
|
|
314
|
-
|
|
364
|
+
/**
|
|
365
|
+
* Rotation of this marker in rad
|
|
366
|
+
*
|
|
367
|
+
* @type {Number}
|
|
368
|
+
*/
|
|
315
369
|
rotation: 0,
|
|
316
370
|
|
|
317
|
-
|
|
318
|
-
|
|
371
|
+
/**
|
|
372
|
+
* Rotate this marker when map rotates
|
|
373
|
+
*
|
|
374
|
+
* @type {Boolean}
|
|
375
|
+
*/
|
|
319
376
|
rotateWithView: false,
|
|
320
377
|
|
|
321
|
-
|
|
322
|
-
|
|
378
|
+
/**
|
|
379
|
+
* Scale of the marker icon
|
|
380
|
+
*
|
|
381
|
+
* @type {Number}
|
|
382
|
+
*/
|
|
323
383
|
scale: undefined,
|
|
324
384
|
|
|
325
385
|
});
|
|
@@ -380,15 +440,16 @@
|
|
|
380
440
|
|
|
381
441
|
L.Marker.include({
|
|
382
442
|
|
|
443
|
+
/**
|
|
444
|
+
* Update L.Marker anchor position after the map
|
|
445
|
+
* is moved by calling `map.setBearing(theta)`
|
|
446
|
+
*
|
|
447
|
+
* @listens L.Map~rotate
|
|
448
|
+
*/
|
|
383
449
|
getEvents: function() {
|
|
384
450
|
return L.extend(markerProto.getEvents.apply(this, arguments), { rotate: this.update });
|
|
385
451
|
},
|
|
386
452
|
|
|
387
|
-
onAdd: function(map) {
|
|
388
|
-
markerProto.onAdd.apply(this, arguments);
|
|
389
|
-
map.on('rotate', this.update, this);
|
|
390
|
-
},
|
|
391
|
-
|
|
392
453
|
_initInteraction: function() {
|
|
393
454
|
var ret = markerProto._initInteraction.apply(this, arguments);
|
|
394
455
|
if (this.dragging && this.dragging.enabled() && this._map && this._map._rotate) {
|
|
@@ -433,12 +494,12 @@
|
|
|
433
494
|
this._resetZIndex();
|
|
434
495
|
},
|
|
435
496
|
|
|
436
|
-
_updateZIndex: function(offset) {
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
},
|
|
497
|
+
// _updateZIndex: function(offset) {
|
|
498
|
+
// if (!this._map._rotate) {
|
|
499
|
+
// return markerProto._updateZIndex.apply(this, arguments);
|
|
500
|
+
// }
|
|
501
|
+
// this._icon.style.zIndex = Math.round(this._zIndex + offset);
|
|
502
|
+
// },
|
|
442
503
|
|
|
443
504
|
setRotation: function(rotation) {
|
|
444
505
|
this.options.rotation = rotation;
|
|
@@ -457,6 +518,12 @@
|
|
|
457
518
|
|
|
458
519
|
L.GridLayer.include({
|
|
459
520
|
|
|
521
|
+
/**
|
|
522
|
+
* Redraw L.TileLayer bounds after the map is
|
|
523
|
+
* moved by just calling `map.setBearing(theta)`
|
|
524
|
+
*
|
|
525
|
+
* @listens L.Map~rotate
|
|
526
|
+
*/
|
|
460
527
|
getEvents: function() {
|
|
461
528
|
var events = gridLayerProto.getEvents.apply(this, arguments);
|
|
462
529
|
if (this._map._rotate && !this.options.updateWhenIdle) {
|
|
@@ -478,35 +545,6 @@
|
|
|
478
545
|
|
|
479
546
|
});
|
|
480
547
|
|
|
481
|
-
/**
|
|
482
|
-
* @external L.Canvas
|
|
483
|
-
*
|
|
484
|
-
* @see https://github.com/Leaflet/Leaflet/tree/v1.9.3/src/layer/vector/Canvas.js
|
|
485
|
-
*/
|
|
486
|
-
|
|
487
|
-
L.extend({}, L.Canvas.prototype);
|
|
488
|
-
|
|
489
|
-
L.Canvas.include({
|
|
490
|
-
|
|
491
|
-
// onAdd: function() {
|
|
492
|
-
// canvasProto.onAdd.apply(this, arguments);
|
|
493
|
-
// // When rotating the canvas itself, it is cleared by some weird reason, so redraw.
|
|
494
|
-
// this._map.on('rotate', this._redraw, this);
|
|
495
|
-
// },
|
|
496
|
-
|
|
497
|
-
// onRemove: function() {
|
|
498
|
-
// canvasProto.onRemove.apply(this, arguments);
|
|
499
|
-
// this._map.off('rotate', this._redraw, this);
|
|
500
|
-
// },
|
|
501
|
-
|
|
502
|
-
// _update: function() {
|
|
503
|
-
// canvasProto._update.apply(this, arguments);
|
|
504
|
-
// // Tell paths to redraw themselves
|
|
505
|
-
// this.fire('update')
|
|
506
|
-
// },
|
|
507
|
-
|
|
508
|
-
});
|
|
509
|
-
|
|
510
548
|
/**
|
|
511
549
|
* @external L.Renderer
|
|
512
550
|
*
|
|
@@ -517,15 +555,15 @@
|
|
|
517
555
|
|
|
518
556
|
L.Renderer.include({
|
|
519
557
|
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
558
|
+
/**
|
|
559
|
+
* Redraw L.Canvas and L.SVG renderer bounds after the
|
|
560
|
+
* map is moved by just calling `map.setBearing(theta)`
|
|
561
|
+
*
|
|
562
|
+
* @listens L.Map~rotate
|
|
563
|
+
*/
|
|
564
|
+
getEvents: function() {
|
|
565
|
+
return L.extend(rendererProto.getEvents.apply(this, arguments), { rotate: this._update });
|
|
566
|
+
},
|
|
529
567
|
|
|
530
568
|
/**
|
|
531
569
|
* @TODO rechek this changes from leaflet@v1.9.3
|
|
@@ -559,25 +597,6 @@
|
|
|
559
597
|
|
|
560
598
|
});
|
|
561
599
|
|
|
562
|
-
/**
|
|
563
|
-
* @external L.SVG
|
|
564
|
-
*
|
|
565
|
-
* @see https://github.com/Leaflet/Leaflet/tree/v1.9.3/src/layer/vector/SVG.js
|
|
566
|
-
*/
|
|
567
|
-
|
|
568
|
-
L.extend({}, L.SVG.prototype);
|
|
569
|
-
|
|
570
|
-
L.SVG.include({
|
|
571
|
-
|
|
572
|
-
// _update: function() {
|
|
573
|
-
// svgProto._update.apply(this, arguments);
|
|
574
|
-
// if (this._map._rotate) {
|
|
575
|
-
// this.fire('update');
|
|
576
|
-
// }
|
|
577
|
-
// },
|
|
578
|
-
|
|
579
|
-
});
|
|
580
|
-
|
|
581
600
|
/**
|
|
582
601
|
* @external L.Map
|
|
583
602
|
*
|
|
@@ -1213,9 +1232,11 @@
|
|
|
1213
1232
|
|
|
1214
1233
|
});
|
|
1215
1234
|
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1235
|
+
/**
|
|
1236
|
+
* Add Compass bearing handler to L.Map (disabled unless `window.DeviceOrientationEvent` is set).
|
|
1237
|
+
*
|
|
1238
|
+
* @property {L.Map.CompassBearing} compassBearing
|
|
1239
|
+
*/
|
|
1219
1240
|
L.Map.addInitHook('addHandler', 'compassBearing', L.Map.CompassBearing);
|
|
1220
1241
|
|
|
1221
1242
|
/**
|
|
@@ -1224,14 +1245,23 @@
|
|
|
1224
1245
|
* @typedef L.Map.ContainerMutation
|
|
1225
1246
|
*/
|
|
1226
1247
|
|
|
1227
|
-
|
|
1228
|
-
|
|
1248
|
+
/**
|
|
1249
|
+
* @TODO check again this file after leaflet v1.9.3 (eg. L.Browser.mutation).
|
|
1250
|
+
* Mutation Observer support will likely be added by default in next releases.
|
|
1251
|
+
*/
|
|
1252
|
+
|
|
1229
1253
|
L.Map.mergeOptions({
|
|
1230
1254
|
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1255
|
+
/**
|
|
1256
|
+
* Whether the map uses mutation observers to
|
|
1257
|
+
* detect changes in its container and trigger
|
|
1258
|
+
* `invalidateSize`. Disabled by default due to
|
|
1259
|
+
* support not being available in all web browsers.
|
|
1260
|
+
*
|
|
1261
|
+
* @type {Boolean}
|
|
1262
|
+
*
|
|
1263
|
+
* @see https://developer.mozilla.org/docs/Web/API/MutationObserver
|
|
1264
|
+
*/
|
|
1235
1265
|
trackContainerMutation: false
|
|
1236
1266
|
|
|
1237
1267
|
});
|
|
@@ -1239,15 +1269,10 @@
|
|
|
1239
1269
|
L.Map.ContainerMutation = L.Handler.extend({
|
|
1240
1270
|
|
|
1241
1271
|
addHooks: function() {
|
|
1242
|
-
|
|
1243
|
-
// if (!L.Browser.mutation) {
|
|
1244
|
-
// return;
|
|
1245
|
-
// }
|
|
1246
|
-
|
|
1272
|
+
// if (!L.Browser.mutation) { return; }
|
|
1247
1273
|
if (!this._observer) {
|
|
1248
|
-
this._observer = new MutationObserver(L.Util.bind(this.
|
|
1274
|
+
this._observer = new MutationObserver(L.Util.bind(this._map.invalidateSize, this._map));
|
|
1249
1275
|
}
|
|
1250
|
-
|
|
1251
1276
|
this._observer.observe(this._map.getContainer(), {
|
|
1252
1277
|
childList: false,
|
|
1253
1278
|
attributes: true,
|
|
@@ -1258,22 +1283,17 @@
|
|
|
1258
1283
|
},
|
|
1259
1284
|
|
|
1260
1285
|
removeHooks: function() {
|
|
1261
|
-
|
|
1262
|
-
// if (!L.Browser.mutation) {
|
|
1263
|
-
// return;
|
|
1264
|
-
// }
|
|
1286
|
+
// if (!L.Browser.mutation) { return; }
|
|
1265
1287
|
this._observer.disconnect();
|
|
1266
1288
|
},
|
|
1267
1289
|
|
|
1268
|
-
_onMutation: function() {
|
|
1269
|
-
this._map.invalidateSize();
|
|
1270
|
-
},
|
|
1271
|
-
|
|
1272
1290
|
});
|
|
1273
1291
|
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1292
|
+
/**
|
|
1293
|
+
* Add Container mutation handler to L.Map (disabled unless `trackContainerMutation` is set).
|
|
1294
|
+
*
|
|
1295
|
+
* @property {L.Map.ContainerMutation} trackContainerMutation
|
|
1296
|
+
*/
|
|
1277
1297
|
L.Map.addInitHook('addHandler', 'trackContainerMutation', L.Map.ContainerMutation);
|
|
1278
1298
|
|
|
1279
1299
|
/**
|
|
@@ -1285,13 +1305,15 @@
|
|
|
1285
1305
|
* @typedef L.Map.TouchGestures
|
|
1286
1306
|
*/
|
|
1287
1307
|
|
|
1288
|
-
// @namespace Map
|
|
1289
|
-
// @section Interaction Options
|
|
1290
1308
|
L.Map.mergeOptions({
|
|
1291
1309
|
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1310
|
+
/**
|
|
1311
|
+
* Set it to false if you don't want the map to
|
|
1312
|
+
* zoom beyond min/max zoom and then bounce back
|
|
1313
|
+
* when pinch-zooming.
|
|
1314
|
+
*
|
|
1315
|
+
* @type {Boolean}
|
|
1316
|
+
*/
|
|
1295
1317
|
bounceAtZoomLimits: true,
|
|
1296
1318
|
|
|
1297
1319
|
});
|
|
@@ -1370,8 +1392,14 @@
|
|
|
1370
1392
|
var bearingDelta = (theta - this._startTheta) * L.DomUtil.RAD_TO_DEG;
|
|
1371
1393
|
if (vector.y < 0) { bearingDelta += 180; }
|
|
1372
1394
|
if (bearingDelta) {
|
|
1373
|
-
|
|
1374
|
-
|
|
1395
|
+
/**
|
|
1396
|
+
* @TODO the pivot should be the last touch point,
|
|
1397
|
+
* but zoomAnimation manages to overwrite the rotate
|
|
1398
|
+
* pane position. Maybe related to #3529.
|
|
1399
|
+
*
|
|
1400
|
+
* @see https://github.com/Leaflet/Leaflet/pull/3529
|
|
1401
|
+
* @see https://github.com/fnicollet/Leaflet/commit/a77af51a6b10f308d1b9a16552091d1d0aee8834
|
|
1402
|
+
*/
|
|
1375
1403
|
map.setBearing(this._startBearing - bearingDelta);
|
|
1376
1404
|
}
|
|
1377
1405
|
}
|
|
@@ -1439,9 +1467,11 @@
|
|
|
1439
1467
|
|
|
1440
1468
|
});
|
|
1441
1469
|
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1470
|
+
/**
|
|
1471
|
+
* Add Touch Gestures handler (enabled unless `touchGestures` is unset).
|
|
1472
|
+
*
|
|
1473
|
+
* @property {L.Map.TouchGestures} touchGestures
|
|
1474
|
+
*/
|
|
1445
1475
|
L.Map.addInitHook('addHandler', 'touchGestures', L.Map.TouchGestures);
|
|
1446
1476
|
|
|
1447
1477
|
/**
|
|
@@ -1450,13 +1480,13 @@
|
|
|
1450
1480
|
* @typedef L.Map.TouchRotate
|
|
1451
1481
|
*/
|
|
1452
1482
|
|
|
1453
|
-
// @namespace Map
|
|
1454
|
-
// @section Interaction Options
|
|
1455
1483
|
L.Map.mergeOptions({
|
|
1456
1484
|
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1485
|
+
/**
|
|
1486
|
+
* Whether the map can be rotated with a two-finger rotation gesture
|
|
1487
|
+
*
|
|
1488
|
+
* @type {Boolean}
|
|
1489
|
+
*/
|
|
1460
1490
|
touchRotate: false,
|
|
1461
1491
|
|
|
1462
1492
|
});
|
|
@@ -1474,24 +1504,25 @@
|
|
|
1474
1504
|
|
|
1475
1505
|
});
|
|
1476
1506
|
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1507
|
+
/**
|
|
1508
|
+
* Add Touch Rotate handler (disabled unless `touchGestures` is set).
|
|
1509
|
+
*
|
|
1510
|
+
* @property {L.Map.TouchGestures} touchGestures
|
|
1511
|
+
*/
|
|
1480
1512
|
L.Map.addInitHook('addHandler', 'touchRotate', L.Map.TouchRotate);
|
|
1481
1513
|
|
|
1482
1514
|
/**
|
|
1483
|
-
* Rotates the map on shift key +
|
|
1515
|
+
* Rotates the map on shift key + mousewheel scrolling (desktop).
|
|
1484
1516
|
*
|
|
1485
1517
|
* @typedef L.Map.ShiftKeyRotate
|
|
1486
1518
|
*/
|
|
1487
1519
|
|
|
1488
|
-
// @namespace Map
|
|
1489
|
-
// @section Interaction Options
|
|
1490
1520
|
L.Map.mergeOptions({
|
|
1491
1521
|
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1522
|
+
/**
|
|
1523
|
+
* Whether the map can be rotated with shift + wheel scroll
|
|
1524
|
+
* @type {Boolean}
|
|
1525
|
+
*/
|
|
1495
1526
|
shiftKeyRotate: true,
|
|
1496
1527
|
|
|
1497
1528
|
});
|
|
@@ -1521,12 +1552,14 @@
|
|
|
1521
1552
|
|
|
1522
1553
|
});
|
|
1523
1554
|
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1555
|
+
/**
|
|
1556
|
+
* Add ShiftKey handler to L.Map (enabled unless `shiftKeyRotate` is unset).
|
|
1557
|
+
*
|
|
1558
|
+
* @property {L.Map.ShiftKeyRotate} shiftKeyRotate
|
|
1559
|
+
*/
|
|
1527
1560
|
L.Map.addInitHook('addHandler', 'shiftKeyRotate', L.Map.ShiftKeyRotate);
|
|
1528
1561
|
|
|
1529
|
-
// decrease
|
|
1562
|
+
// decrease `scrollWheelZoom` handler priority over `shiftKeyRotate` handler
|
|
1530
1563
|
L.Map.addInitHook(function() {
|
|
1531
1564
|
if (this.scrollWheelZoom.enabled() && this.shiftKeyRotate.enabled()) {
|
|
1532
1565
|
this.scrollWheelZoom.disable();
|
|
@@ -1542,25 +1575,32 @@
|
|
|
1542
1575
|
* @external L.Map.TouchZoom
|
|
1543
1576
|
*/
|
|
1544
1577
|
|
|
1545
|
-
// @namespace Map
|
|
1546
|
-
// @section Interaction Options
|
|
1547
1578
|
L.Map.mergeOptions({
|
|
1548
1579
|
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1580
|
+
/**
|
|
1581
|
+
* Whether the map can be zoomed by touch-dragging
|
|
1582
|
+
* with two fingers. If passed `'center'`, it will
|
|
1583
|
+
* zoom to the center of the view regardless of
|
|
1584
|
+
* where the touch events (fingers) were. Enabled
|
|
1585
|
+
* for touch-capable web browsers.
|
|
1586
|
+
*
|
|
1587
|
+
* @type {(Boolean|String)}
|
|
1588
|
+
*/
|
|
1555
1589
|
touchZoom: L.Browser.touch,
|
|
1556
1590
|
|
|
1557
1591
|
/**
|
|
1558
|
-
*
|
|
1592
|
+
*
|
|
1559
1593
|
*/
|
|
1560
1594
|
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1595
|
+
/**
|
|
1596
|
+
* @TODO check if this is a duplicate of `L.Map.TouchGestures::bounceAtZoomLimits`
|
|
1597
|
+
*
|
|
1598
|
+
* Set it to false if you don't want the map to
|
|
1599
|
+
* zoom beyond min/max zoom and then bounce back
|
|
1600
|
+
* when pinch-zooming.
|
|
1601
|
+
*
|
|
1602
|
+
* @type {Boolean}
|
|
1603
|
+
*/
|
|
1564
1604
|
bounceAtZoomLimits: false,
|
|
1565
1605
|
|
|
1566
1606
|
});
|
|
@@ -1580,9 +1620,11 @@
|
|
|
1580
1620
|
|
|
1581
1621
|
});
|
|
1582
1622
|
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1623
|
+
/**
|
|
1624
|
+
* Add Touch Zoom handler (disabled unless `L.Browser.touch` is set).
|
|
1625
|
+
*
|
|
1626
|
+
* @property {L.Map.TouchGestures} touchGestures
|
|
1627
|
+
*/
|
|
1586
1628
|
L.Map.addInitHook('addHandler', 'touchZoom', L.Map.TouchZoom);
|
|
1587
1629
|
|
|
1588
1630
|
/**
|