leaflet-rotate 0.3.0 → 0.4.0
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 +1 -1
- package/build/test.js +18 -0
- package/dist/leaflet-rotate-src.js +261 -216
- package/dist/leaflet-rotate-src.js.map +3 -3
- package/dist/leaflet-rotate.js +1 -1
- package/dist/leaflet-rotate.js.map +3 -3
- package/lib/debug.js +84 -66
- package/lib/debug.min.js +1 -1
- package/misc/leaflet-heat-rotate.js +7 -7
- package/misc/loremIpsum.js +1 -1
- package/misc/places.js +1 -1
- package/misc/route.js +1 -1
- package/package.json +5 -5
- package/src/control/Rotate.js +20 -24
- package/src/dom/DomUtil.js +31 -47
- package/src/dom/Draggable.js +1 -1
- package/src/geometry/Point.js +16 -7
- package/src/layer/DivOverlay.js +10 -8
- package/src/layer/Popup.js +15 -13
- package/src/layer/Tooltip.js +5 -5
- package/src/layer/marker/Icon.js +8 -8
- package/src/layer/marker/Marker.js +18 -18
- package/src/layer/tile/GridLayer.js +4 -4
- package/src/layer/vector/Renderer.js +47 -7
- package/src/map/Map.js +71 -66
- package/src/map/handler/CompassBearing.js +6 -6
- package/src/map/handler/ContainerMutation.js +2 -2
- package/src/map/handler/ShiftKeyRotate.js +4 -4
- package/src/map/handler/TouchGestures.js +29 -23
- package/src/map/handler/TouchRotate.js +2 -2
- package/src/map/handler/TouchZoom.js +4 -4
- package/test/features/example.feature +5 -0
- package/test/index.html +59 -22
- package/test/steps/bearing.steps.js +3 -3
- package/test/steps/example.steps.js +72 -11
- package/test/steps/gestures.steps.js +4 -4
- package/test/steps/overlays.steps.js +32 -32
- package/test/support/hooks.js +50 -2
package/lib/debug.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
(function() {
|
|
2
|
+
const L = Object.isExtensible(globalThis.L) ? globalThis.L : Object.assign({}, globalThis.L);
|
|
3
|
+
globalThis.L = L;
|
|
4
|
+
L.Rotate = {
|
|
2
5
|
|
|
3
|
-
debug
|
|
6
|
+
debug(map, options = {}) {
|
|
4
7
|
|
|
5
8
|
this._map = map;
|
|
6
9
|
|
|
@@ -187,8 +190,8 @@ L.Rotate = {
|
|
|
187
190
|
this.___mainBounds = L.DomUtil.create('div', 'panebounds main', map._mapPane);
|
|
188
191
|
this.updatePaneBounds();
|
|
189
192
|
|
|
190
|
-
|
|
191
|
-
|
|
193
|
+
const rhoInput = document.getElementById('rho_input');
|
|
194
|
+
const padInput = document.getElementById('pad_input');
|
|
192
195
|
|
|
193
196
|
rhoInput.addEventListener('change', L.Rotate.rotate.bind(this));
|
|
194
197
|
rhoInput.addEventListener('mousemove', L.Rotate.rotate.bind(this));
|
|
@@ -224,7 +227,23 @@ L.Rotate = {
|
|
|
224
227
|
map.compassBearing.enable();
|
|
225
228
|
}
|
|
226
229
|
|
|
227
|
-
|
|
230
|
+
if (L.version.startsWith('2.')) {
|
|
231
|
+
const container = map.getContainer();
|
|
232
|
+
container.addEventListener('mousemove', function(e) {
|
|
233
|
+
const rect = container.getBoundingClientRect(),
|
|
234
|
+
containerPoint = new L.Point(
|
|
235
|
+
e.clientX - rect.left - container.clientLeft,
|
|
236
|
+
e.clientY - rect.top - container.clientTop
|
|
237
|
+
);
|
|
238
|
+
L.Rotate.logMouse.call(map, {
|
|
239
|
+
latlng: map.containerPointToLatLng(containerPoint),
|
|
240
|
+
layerPoint: map.containerPointToLayerPoint(containerPoint),
|
|
241
|
+
containerPoint: containerPoint
|
|
242
|
+
});
|
|
243
|
+
});
|
|
244
|
+
} else {
|
|
245
|
+
map.on('mousemove', this.logMouse);
|
|
246
|
+
}
|
|
228
247
|
map.on('locationfound', this.resetHeading);
|
|
229
248
|
|
|
230
249
|
if (options.log) {
|
|
@@ -236,11 +255,11 @@ L.Rotate = {
|
|
|
236
255
|
|
|
237
256
|
},
|
|
238
257
|
|
|
239
|
-
logEvent
|
|
258
|
+
logEvent(e) {
|
|
240
259
|
console.log(e, e.type);
|
|
241
260
|
},
|
|
242
261
|
|
|
243
|
-
logMouse
|
|
262
|
+
logMouse(e) {
|
|
244
263
|
document.getElementById('llx').innerHTML = e.latlng.lng;
|
|
245
264
|
document.getElementById('lly').innerHTML = e.latlng.lat;
|
|
246
265
|
document.getElementById('lyx').innerHTML = e.layerPoint.x;
|
|
@@ -252,11 +271,11 @@ L.Rotate = {
|
|
|
252
271
|
/**
|
|
253
272
|
* Debug L.Map.setBearing()
|
|
254
273
|
*/
|
|
255
|
-
rotate
|
|
274
|
+
rotate(e) {
|
|
256
275
|
return (e.type !== 'mousemove' || e.buttons !== 0) && this._map.setBearing(e.target.valueAsNumber);
|
|
257
276
|
},
|
|
258
277
|
|
|
259
|
-
updatePaneBounds
|
|
278
|
+
updatePaneBounds() {
|
|
260
279
|
const size = this._map.getSize();
|
|
261
280
|
for (const bounds of [this.___rotateBounds, this.___mainBounds]) {
|
|
262
281
|
bounds.style.width = size.x + 'px';
|
|
@@ -267,7 +286,7 @@ L.Rotate = {
|
|
|
267
286
|
/**
|
|
268
287
|
* Debug L.Map._pixelOrigin
|
|
269
288
|
*/
|
|
270
|
-
updatePixelOrigin
|
|
289
|
+
updatePixelOrigin() {
|
|
271
290
|
if (this._pixelOrigin) {
|
|
272
291
|
document.getElementById('ogx').innerHTML = this._pixelOrigin.x;
|
|
273
292
|
document.getElementById('ogy').innerHTML = this._pixelOrigin.y;
|
|
@@ -279,7 +298,7 @@ L.Rotate = {
|
|
|
279
298
|
/**
|
|
280
299
|
* Debug L.Map._pivot
|
|
281
300
|
*/
|
|
282
|
-
updatePivotDot
|
|
301
|
+
updatePivotDot() {
|
|
283
302
|
if (this._pivot) {
|
|
284
303
|
document.getElementById('pvx').innerHTML = this._pivot.x;
|
|
285
304
|
document.getElementById('pvy').innerHTML = this._pivot.y;
|
|
@@ -291,8 +310,8 @@ L.Rotate = {
|
|
|
291
310
|
/**
|
|
292
311
|
* Debug L.Map._getMapPanePos()
|
|
293
312
|
*/
|
|
294
|
-
updatePanePos
|
|
295
|
-
|
|
313
|
+
updatePanePos() {
|
|
314
|
+
const panePos = this._getMapPanePos();
|
|
296
315
|
document.getElementById('pox').innerHTML = panePos.x;
|
|
297
316
|
document.getElementById('poy').innerHTML = panePos.y;
|
|
298
317
|
},
|
|
@@ -300,26 +319,26 @@ L.Rotate = {
|
|
|
300
319
|
/**
|
|
301
320
|
* Debug L.Map.getBearing()
|
|
302
321
|
*/
|
|
303
|
-
updateRhoInput
|
|
322
|
+
updateRhoInput() {
|
|
304
323
|
document.getElementById('rho_input').value = this.getBearing();
|
|
305
324
|
},
|
|
306
325
|
|
|
307
326
|
/**
|
|
308
327
|
* Debug L.Map.setBearing()
|
|
309
328
|
*/
|
|
310
|
-
rotateOneDegree
|
|
311
|
-
|
|
329
|
+
rotateOneDegree() {
|
|
330
|
+
const angle = document.getElementById('rho_input').valueAsNumber++;
|
|
312
331
|
this.setBearing(angle < 360 ? angle : 0);
|
|
313
332
|
},
|
|
314
333
|
|
|
315
334
|
/**
|
|
316
335
|
* Debug L.Marker.setRotation()
|
|
317
336
|
*/
|
|
318
|
-
randomRotateMarkers
|
|
319
|
-
|
|
337
|
+
randomRotateMarkers(map) {
|
|
338
|
+
const markers = [],
|
|
320
339
|
steps = [];
|
|
321
340
|
|
|
322
|
-
for (
|
|
341
|
+
for (const i in map._layers) {
|
|
323
342
|
if (map._layers[i] instanceof L.Marker) {
|
|
324
343
|
markers.push(map._layers[i]);
|
|
325
344
|
steps.push(Math.random() * Math.PI / 30 + 0.1);
|
|
@@ -327,7 +346,7 @@ L.Rotate = {
|
|
|
327
346
|
}
|
|
328
347
|
|
|
329
348
|
function stepOn(steps_left) {
|
|
330
|
-
for (
|
|
349
|
+
for (let i = 0; i < markers.length; i++) {
|
|
331
350
|
markers[i].setRotation(markers[i].options.rotation + steps[i]);
|
|
332
351
|
}
|
|
333
352
|
if (--steps_left) setTimeout(stepOn.bind(null, steps_left), 20);
|
|
@@ -339,17 +358,17 @@ L.Rotate = {
|
|
|
339
358
|
/**
|
|
340
359
|
* Debug L.Map.panInside()
|
|
341
360
|
*/
|
|
342
|
-
randomMarkers
|
|
343
|
-
|
|
344
|
-
|
|
361
|
+
randomMarkers(map, number) {
|
|
362
|
+
map = this._map;
|
|
363
|
+
const populate = function() {
|
|
345
364
|
// populate map with a cluster of random markers
|
|
346
|
-
for (
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
365
|
+
for (let i = 0; i < number; i++) {
|
|
366
|
+
const bounds = map.getBounds();
|
|
367
|
+
const southWest = bounds.getSouthWest();
|
|
368
|
+
const northEast = bounds.getNorthEast();
|
|
369
|
+
const lngSpan = northEast.lng - southWest.lng;
|
|
370
|
+
const latSpan = northEast.lat - southWest.lat;
|
|
371
|
+
const m = new L.Marker(new L.LatLng(southWest.lat + latSpan * Math.random(), southWest.lng + lngSpan * Math.random()));
|
|
353
372
|
// m.addTo(L.Rotate._map);
|
|
354
373
|
L.Rotate.___cluster.addLayer(m);
|
|
355
374
|
}
|
|
@@ -381,12 +400,12 @@ L.Rotate = {
|
|
|
381
400
|
/**
|
|
382
401
|
* Debug L.Map.getCenter()
|
|
383
402
|
*/
|
|
384
|
-
displayCenter
|
|
385
|
-
|
|
403
|
+
displayCenter() {
|
|
404
|
+
const map = this._map;
|
|
386
405
|
if (this.___centerMarker) {
|
|
387
406
|
this.___centerMarker.remove();
|
|
388
407
|
}
|
|
389
|
-
this.___centerMarker = L.
|
|
408
|
+
this.___centerMarker = new L.CircleMarker(map.getCenter(), {
|
|
390
409
|
radius: 3,
|
|
391
410
|
color: 'red',
|
|
392
411
|
}).addTo(map).bindTooltip('<b>center</b>', { direction: 'right', permanent: true, });
|
|
@@ -396,15 +415,15 @@ L.Rotate = {
|
|
|
396
415
|
/**
|
|
397
416
|
* Debug L.Map.getCenter()
|
|
398
417
|
*/
|
|
399
|
-
displayBounds
|
|
400
|
-
|
|
418
|
+
displayBounds() {
|
|
419
|
+
const map = this._map;
|
|
401
420
|
if (this.___bounds) {
|
|
402
421
|
this.___bounds.remove();
|
|
403
422
|
}
|
|
404
423
|
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
this.___bounds = L.
|
|
424
|
+
const padding = document.getElementById('pad_input').valueAsNumber;
|
|
425
|
+
const latLngBounds = map.getBounds().pad(padding)
|
|
426
|
+
this.___bounds = new L.Rectangle(latLngBounds, {
|
|
408
427
|
fill: false,
|
|
409
428
|
lineCap: 'square',
|
|
410
429
|
color: 'yellow',
|
|
@@ -417,17 +436,17 @@ L.Rotate = {
|
|
|
417
436
|
/**
|
|
418
437
|
* DEBUG: map.flyToBounds(path.getBounds())
|
|
419
438
|
*/
|
|
420
|
-
displayLayersBounds
|
|
439
|
+
displayLayersBounds() {
|
|
421
440
|
for (const flytopath of ['path', 'polygon', 'circle']) {
|
|
422
441
|
if (!globalThis[flytopath]) {
|
|
423
442
|
continue;
|
|
424
443
|
} else if (this[`___${flytopath}bounds`]) {
|
|
425
444
|
this[`___${flytopath}bounds`].remove();
|
|
426
445
|
}
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
this[`___${flytopath}bounds`] = L.
|
|
430
|
-
L.
|
|
446
|
+
const layer = globalThis[flytopath];
|
|
447
|
+
const layerBounds = layer.getBounds();
|
|
448
|
+
this[`___${flytopath}bounds`] = new L.FeatureGroup([
|
|
449
|
+
new L.Rectangle(layerBounds, {
|
|
431
450
|
fill: false,
|
|
432
451
|
lineCap: 'square',
|
|
433
452
|
color: 'yellow',
|
|
@@ -435,10 +454,10 @@ L.Rotate = {
|
|
|
435
454
|
weight: 1,
|
|
436
455
|
opacity: 0.5
|
|
437
456
|
}),
|
|
438
|
-
L.
|
|
439
|
-
L.
|
|
440
|
-
L.
|
|
441
|
-
L.
|
|
457
|
+
new L.Marker(layerBounds.getNorthWest(), { scale: 0.5, rotation: -45 * (Math.PI / 180), rotateWithView: true }).bindTooltip('<b>NW</b>', {direction: 'center'}),
|
|
458
|
+
new L.Marker(layerBounds.getNorthEast(), { scale: 0.5, rotation: 45 * (Math.PI / 180), rotateWithView: true }).bindTooltip('<b>NE</b>', {direction: 'center'}),
|
|
459
|
+
new L.Marker(layerBounds.getSouthEast(), { scale: 0.5, rotation: 135 * (Math.PI / 180), rotateWithView: true }).bindTooltip('<b>SE</b>', {direction: 'center'}),
|
|
460
|
+
new L.Marker(layerBounds.getSouthWest(), { scale: 0.5, rotation: -135 * (Math.PI / 180), rotateWithView: true }).bindTooltip('<b>SW</b>', {direction: 'center'}),
|
|
442
461
|
]).addTo(map).eachLayer(m => { if (m.getElement && m.getElement()) m.getElement().style.filter = 'hue-rotate(150deg)'; });
|
|
443
462
|
}
|
|
444
463
|
},
|
|
@@ -446,25 +465,23 @@ L.Rotate = {
|
|
|
446
465
|
/**
|
|
447
466
|
* @TODO Debug L.Map.getPixelBounds()
|
|
448
467
|
*/
|
|
449
|
-
displayPixelBounds
|
|
450
|
-
|
|
468
|
+
displayPixelBounds() {
|
|
469
|
+
const map = this._map;
|
|
451
470
|
this.___corners && this.___corners.remove();
|
|
452
471
|
this.___pixelbounds && this.___pixelbounds.remove();
|
|
453
472
|
|
|
454
473
|
const size = map.getSize();
|
|
455
474
|
const pixelBounds = map.getPixelBounds();
|
|
456
475
|
|
|
457
|
-
const TL = L.
|
|
458
|
-
const TR = L.
|
|
459
|
-
const BR = L.
|
|
460
|
-
const BL = L.
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
const
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
this.___corners = L.featureGroup([topLeft, topRight, bottomRight, bottomLeft]).addTo(map).eachLayer(marker => marker.getElement().style.filter = 'hue-rotate(150deg)');
|
|
476
|
+
const TL = new L.Point(0, 0);
|
|
477
|
+
const TR = new L.Point(size.x, 0);
|
|
478
|
+
const BR = new L.Point(size.x, size.y);
|
|
479
|
+
const BL = new L.Point(0, size.y);
|
|
480
|
+
const topLeft = new L.Marker(map.containerPointToLatLng(TL), { title: 'Top Left corner', rotation: -45 * (Math.PI / 180) });
|
|
481
|
+
const topRight = new L.Marker(map.containerPointToLatLng(TR), { title: 'Top Right corner', rotation: 45 * (Math.PI / 180) });
|
|
482
|
+
const bottomRight = new L.Marker(map.containerPointToLatLng(BR), { title: 'Bottom Right corner', rotation: 135 * (Math.PI / 180) });
|
|
483
|
+
const bottomLeft = new L.Marker(map.containerPointToLatLng(BL), { title: 'Bottom Left corner', rotation: -135 * (Math.PI / 180) });
|
|
484
|
+
this.___corners = new L.FeatureGroup([topLeft, topRight, bottomRight, bottomLeft]).addTo(map).eachLayer(marker => marker.getElement().style.filter = 'hue-rotate(150deg)');
|
|
468
485
|
|
|
469
486
|
// L.polyline([
|
|
470
487
|
// [topLeft.getLatLng(), topRight.getLatLng()],
|
|
@@ -504,9 +521,9 @@ L.Rotate = {
|
|
|
504
521
|
// map.layerPointToLatLng([0, size.y]), // bottomleft
|
|
505
522
|
// ]);
|
|
506
523
|
|
|
507
|
-
// const paddingTL = L.
|
|
508
|
-
// paddingBR = L.
|
|
509
|
-
// pixelBounds = L.
|
|
524
|
+
// const paddingTL = new L.Point(L.Marker.prototype.options.icon.options.iconAnchor || [0, 0]),
|
|
525
|
+
// paddingBR = new L.Point(L.Marker.prototype.options.icon.options.iconSize || [0, 0]).subtract(paddingTL),
|
|
526
|
+
// pixelBounds = new L.Bounds([new L.Point(rect), new L.Point(rect).add(map.getSize()) ]),
|
|
510
527
|
// paddedBounds = L.latLngBounds([
|
|
511
528
|
// map.layerPointToLatLng(pixelBounds.min.add(paddingTL)),
|
|
512
529
|
// map.layerPointToLatLng(pixelBounds.max.subtract(paddingBR))
|
|
@@ -517,7 +534,7 @@ L.Rotate = {
|
|
|
517
534
|
document.getElementById('ogby').innerHTML = JSON.stringify(pixelBounds.max);
|
|
518
535
|
},
|
|
519
536
|
|
|
520
|
-
resetHeading
|
|
537
|
+
resetHeading(e) {
|
|
521
538
|
if (e.heading !== null) {
|
|
522
539
|
this.setBearing(e.heading);
|
|
523
540
|
}
|
|
@@ -526,11 +543,12 @@ L.Rotate = {
|
|
|
526
543
|
/**
|
|
527
544
|
* Debug L.Map.locate()
|
|
528
545
|
*/
|
|
529
|
-
locate
|
|
546
|
+
locate() {
|
|
530
547
|
this._map.locate({
|
|
531
548
|
setView: true,
|
|
532
549
|
enableHighAccuracy: true
|
|
533
550
|
});
|
|
534
551
|
}
|
|
535
552
|
|
|
536
|
-
};
|
|
553
|
+
};
|
|
554
|
+
})();
|
package/lib/debug.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
L.Rotate={debug:function(t,n={}){this._map=t,document.head.insertAdjacentHTML("beforeend",'<style>.leaflet-rotate-info{width:100%}.leaflet-rotate-info td{overflow:hidden;text-overflow:ellipsis}.leaflet-rotate-info td:nth-of-type(3){font-family:Monospace}.leaflet-rotate-info th{text-align:left}div.crosshair{position:absolute;width:1px;height:1px;border:1px solid green;z-index:100;left:50%;right:50%}div.pivot,div.pixelorigin{position:absolute;width:1px;height:1px;border:5px solid yellow;border-radius:100%;z-index:1000}div.pivot:before{left:-1.5em;bottom:-2em;position:absolute;content:"PIVOT";color:#ff0}div.pixelorigin:before{left:-1.75em;top:-2em;position:absolute;content:"ORIGIN";color:#ff0}div.panebounds.main{position:absolute;width:800px;height:600px;box-sizing:border-box;border:1px solid red;border-bottom:1px red dashed;border-right:1px red dashed;z-index:100}div.panebounds.rotate{position:absolute;width:800px;height:600px;box-sizing:border-box;border:1px solid purple;border-bottom:1px purple dashed;border-right:1px purple dashed;z-index:100}div.crosshair.c1{left:calc(50% - 5px);top:50%;height:0;width:10px}div.crosshair.c2{left:50%;top:calc(50% - 5px);width:0;height:10px}#rho_input{vertical-align:middle}.panebounds:before{padding:1ch}.panebounds.rotate:before{float:right;content:"ROTATED"}.panebounds.main:before{float:left;content:"MAIN"}</style>'),t._container.insertAdjacentHTML("afterbegin",'<div class="crosshair c1"></div><div class="crosshair c2"></div>'),t._container.insertAdjacentHTML("afterend",`<hr><table class="leaflet-rotate-info"><tr><td><button onclick="L.Rotate._map.setBearing(0);" title="map.setBearing(0);"> 0</button><button onclick="L.Rotate._map.setBearing(15);" title="map.setBearing(15);">15</button><button onclick="L.Rotate._map.setBearing(30);" title="map.setBearing(30);">30</button><button onclick="L.Rotate._map.setBearing(45);" title="map.setBearing(45);">45</button><button onclick="L.Rotate._map.setBearing(60);" title="map.setBearing(60);">60</button><button onclick="L.Rotate._map.setBearing(75);" title="map.setBearing(75);">75</button><button onclick="L.Rotate._map.setBearing(90);" title="map.setBearing(90);">90</button><button onclick="L.Rotate._map.setBearing(180);" title="map.setBearing(180);">180</button></td><td><input title="increase/decrease rotation angle" type="range" min="0" max="360" step="1" value="0" name="rho" id='rho_input' /><span id='rho'></span></td><td><input title="increase/decrease padding bounds" type="range" min="-0.25" max="0" value="0" step="0.01" name="pad" id='pad_input' /></td><td><button onclick="L.Rotate.randomRotateMarkers(L.Rotate._map);" title="markers.setRotation(Math.random() * Math.PI / 30 + 0.1)">Rotate Markers</button><button onclick="L.Rotate.randomMarkers(L.Rotate._map, 100);" title="add 100 random markers to map">Add Markers</button></td></tr><tr><th>LatLng </th><td id='llx'></td><td id='lly'></td><td class='long'>LatLng of mouse pointer</td></tr><tr><th>Rel to pane </th><td id='lyx'></td><td id='lyy'></td><td class='long'>Mouse pointer pixel coords relative to _rotatePane</td></tr><tr><th>Rel to container</th><td id='cnx'></td><td id='cny'></td><td class='long'>Mouse pointer coords relative to map <div></td></tr><tr><th>Pivot </th><td id='pvx'></td><td id='pvy'></td><td class='long'>Last _rotationPane pivot pixel coords relative to _rotationPane</td></tr><tr><th>Pane offset </th><td id='pox'></td><td id='poy'></td><td class='long'>Pixel offset of _mapPane</td></tr><tr><th>Pixel origin </th><td id='ogx'></td><td id='ogy'></td><td class='long'>Negative pixel coords of the (0,0) CRS point relative to _rotatePane</td></tr><tr><th>Pixel bounds </th><td id='ogbx'></td><td id='ogby'></td><td class='long'>Bounds of the current map view in projected pixel coordinates {min, max}.</td></tr></table>`),t.___rotatePixelOrigin=L.DomUtil.create("div","pixelorigin",t._rotatePane),t.___rotatePivotDot=L.DomUtil.create("div","pivot",t._mapPane),this.___rotateBounds=L.DomUtil.create("div","panebounds rotate",t._rotatePane),this.___mainBounds=L.DomUtil.create("div","panebounds main",t._mapPane),this.updatePaneBounds();var e=document.getElementById("rho_input"),o=document.getElementById("pad_input");e.addEventListener("change",L.Rotate.rotate.bind(this)),e.addEventListener("mousemove",L.Rotate.rotate.bind(this)),o.addEventListener("change",L.Rotate.displayCenter.bind(this)),o.addEventListener("mousemove",L.Rotate.displayCenter.bind(this)),o.addEventListener("change",L.Rotate.displayBounds.bind(this)),o.addEventListener("mousemove",L.Rotate.displayBounds.bind(this)),o.addEventListener("change",L.Rotate.displayLayersBounds.bind(this)),o.addEventListener("mousemove",L.Rotate.displayLayersBounds.bind(this)),o.addEventListener("change",L.Rotate.displayPixelBounds.bind(this)),o.addEventListener("mousemove",L.Rotate.displayPixelBounds.bind(this)),t.on("move rotate zoomend",this.updatePanePos),t.on("resize",this.updatePaneBounds.bind(this)),t.on("rotate zoomend load",this.updatePixelOrigin),t.on("rotate",this.updateRhoInput),t.on("rotate",this.updatePivotDot),t.on("moveend zoomend resetview rotate",this.displayCenter.bind(this)),t.on("moveend zoomend resetview rotate",this.displayBounds.bind(this)),t.on("moveend zoomend resetview rotate",this.displayLayersBounds.bind(this)),t.on("moveend zoomend resetview rotate",this.displayPixelBounds.bind(this)),this.updatePixelOrigin.call(t),this.updateRhoInput.call(t),this.updatePivotDot.call(t),this.displayCenter.call(this),this.displayBounds.call(this),this.displayLayersBounds.call(this),this.displayPixelBounds.call(this),L.Browser.mobile&&t.compassBearing.enable(),t.on("mousemove",this.logMouse),t.on("locationfound",this.resetHeading),n.log&&t.on("click movestart move moveend zoomstart zoomend locationfound locationerror locationfound",this.logEvent)},logEvent:function(t){console.log(t,t.type)},logMouse:function(t){document.getElementById("llx").innerHTML=t.latlng.lng,document.getElementById("lly").innerHTML=t.latlng.lat,document.getElementById("lyx").innerHTML=t.layerPoint.x,document.getElementById("lyy").innerHTML=t.layerPoint.y,document.getElementById("cnx").innerHTML=t.containerPoint.x,document.getElementById("cny").innerHTML=t.containerPoint.y},rotate:function(t){return(t.type!=="mousemove"||t.buttons!==0)&&this._map.setBearing(t.target.valueAsNumber)},updatePaneBounds:function(){const t=this._map.getSize();for(const n of[this.___rotateBounds,this.___mainBounds])n.style.width=t.x+"px",n.style.height=t.y+"px"},updatePixelOrigin:function(){this._pixelOrigin&&(document.getElementById("ogx").innerHTML=this._pixelOrigin.x,document.getElementById("ogy").innerHTML=this._pixelOrigin.y,this.___rotatePixelOrigin.style.left=-this._pixelOrigin.x-1+"px",this.___rotatePixelOrigin.style.top=-this._pixelOrigin.y-1+"px")},updatePivotDot:function(){this._pivot&&(document.getElementById("pvx").innerHTML=this._pivot.x,document.getElementById("pvy").innerHTML=this._pivot.y,this.___rotatePivotDot.style.left=this._pivot.x-1+"px",this.___rotatePivotDot.style.top=this._pivot.y-1+"px")},updatePanePos:function(){var t=this._getMapPanePos();document.getElementById("pox").innerHTML=t.x,document.getElementById("poy").innerHTML=t.y},updateRhoInput:function(){document.getElementById("rho_input").value=this.getBearing()},rotateOneDegree:function(){var t=document.getElementById("rho_input").valueAsNumber++;this.setBearing(t<360?t:0)},randomRotateMarkers:function(t){var n=[],e=[];for(var o in t._layers)t._layers[o]instanceof L.Marker&&(n.push(t._layers[o]),e.push(Math.random()*Math.PI/30+.1));function a(r){for(var i=0;i<n.length;i++)n[i].setRotation(n[i].options.rotation+e[i]);--r&&setTimeout(a.bind(null,r),20)}a(25)},randomMarkers:function(e,n){var e=this._map,o=function(){for(var a=0;a<n;a++){var r=e.getBounds(),i=r.getSouthWest(),s=r.getNorthEast(),d=s.lng-i.lng,l=s.lat-i.lat,c=L.marker(L.latLng(i.lat+l*Math.random(),i.lng+d*Math.random()));L.Rotate.___cluster.addLayer(c)}};this.___cluster?typeof L.markerClusterGroup=="function"&&o():this.___cluster=import("https://unpkg.com/leaflet.markercluster@1.4.1/src/index.js").then(a=>{document.head.insertAdjacentHTML("beforeend",'<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css"><link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css">'),Object.assign(globalThis.L,a),this.___cluster=L.markerClusterGroup({spiderfyOnMaxZoom:!1,showCoverageOnHover:!1,zoomToBoundsOnClick:!1}).on("clusterclick",r=>r.layer.spiderfy()).addTo(e),o()})},displayCenter:function(){var t=this._map;this.___centerMarker&&this.___centerMarker.remove(),this.___centerMarker=L.circleMarker(t.getCenter(),{radius:3,color:"red"}).addTo(t).bindTooltip("<b>center</b>",{direction:"right",permanent:!0}),this.___centerMarker.getTooltip().getElement().setAttribute("tabindex","-1")},displayBounds:function(){var t=this._map;this.___bounds&&this.___bounds.remove();var n=document.getElementById("pad_input").valueAsNumber,e=t.getBounds().pad(n);this.___bounds=L.rectangle(e,{fill:!1,lineCap:"square",color:"yellow",dashArray:"5, 10",weight:2}).addTo(t)},displayLayersBounds:function(){for(const t of["path","polygon","circle"]){if(globalThis[t])this[`___${t}bounds`]&&this[`___${t}bounds`].remove();else continue;let e=globalThis[t].getBounds();this[`___${t}bounds`]=L.featureGroup([L.rectangle(e,{fill:!1,lineCap:"square",color:"yellow",dashArray:"5, 10",weight:1,opacity:.5}),L.marker(e.getNorthWest(),{scale:.5,rotation:-45*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>NW</b>",{direction:"center"}),L.marker(e.getNorthEast(),{scale:.5,rotation:45*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>NE</b>",{direction:"center"}),L.marker(e.getSouthEast(),{scale:.5,rotation:135*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>SE</b>",{direction:"center"}),L.marker(e.getSouthWest(),{scale:.5,rotation:-135*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>SW</b>",{direction:"center"})]).addTo(map).eachLayer(o=>{o.getElement&&o.getElement()&&(o.getElement().style.filter="hue-rotate(150deg)")})}},displayPixelBounds:function(){var t=this._map;this.___corners&&this.___corners.remove(),this.___pixelbounds&&this.___pixelbounds.remove();const n=t.getSize(),e=t.getPixelBounds(),o=L.point(0,0),a=L.point(n.x,0),r=L.point(n.x,n.y),i=L.point(0,n.y),s=L.marker(t.containerPointToLatLng(o),{title:"Top Left corner",rotation:-45*L.DomUtil.DEG_TO_RAD}),d=L.marker(t.containerPointToLatLng(a),{title:"Top Right corner",rotation:45*L.DomUtil.DEG_TO_RAD}),l=L.marker(t.containerPointToLatLng(r),{title:"Bottom Right corner",rotation:135*L.DomUtil.DEG_TO_RAD}),c=L.marker(t.containerPointToLatLng(i),{title:"Bottom Left corner",rotation:-135*L.DomUtil.DEG_TO_RAD});this.___corners=L.featureGroup([s,d,l,c]).addTo(t).eachLayer(u=>u.getElement().style.filter="hue-rotate(150deg)"),document.getElementById("ogbx").innerHTML=JSON.stringify(e.min),document.getElementById("ogby").innerHTML=JSON.stringify(e.max)},resetHeading:function(t){t.heading!==null&&this.setBearing(t.heading)},locate:function(){this._map.locate({setView:!0,enableHighAccuracy:!0})}};
|
|
1
|
+
(function(){const e=Object.isExtensible(globalThis.L)?globalThis.L:Object.assign({},globalThis.L);globalThis.L=e,e.Rotate={debug(t,n={}){this._map=t,document.head.insertAdjacentHTML("beforeend",'<style>.leaflet-rotate-info{width:100%}.leaflet-rotate-info td{overflow:hidden;text-overflow:ellipsis}.leaflet-rotate-info td:nth-of-type(3){font-family:Monospace}.leaflet-rotate-info th{text-align:left}div.crosshair{position:absolute;width:1px;height:1px;border:1px solid green;z-index:100;left:50%;right:50%}div.pivot,div.pixelorigin{position:absolute;width:1px;height:1px;border:5px solid yellow;border-radius:100%;z-index:1000}div.pivot:before{left:-1.5em;bottom:-2em;position:absolute;content:"PIVOT";color:#ff0}div.pixelorigin:before{left:-1.75em;top:-2em;position:absolute;content:"ORIGIN";color:#ff0}div.panebounds.main{position:absolute;width:800px;height:600px;box-sizing:border-box;border:1px solid red;border-bottom:1px red dashed;border-right:1px red dashed;z-index:100}div.panebounds.rotate{position:absolute;width:800px;height:600px;box-sizing:border-box;border:1px solid purple;border-bottom:1px purple dashed;border-right:1px purple dashed;z-index:100}div.crosshair.c1{left:calc(50% - 5px);top:50%;height:0;width:10px}div.crosshair.c2{left:50%;top:calc(50% - 5px);width:0;height:10px}#rho_input{vertical-align:middle}.panebounds:before{padding:1ch}.panebounds.rotate:before{float:right;content:"ROTATED"}.panebounds.main:before{float:left;content:"MAIN"}</style>'),t._container.insertAdjacentHTML("afterbegin",'<div class="crosshair c1"></div><div class="crosshair c2"></div>'),t._container.insertAdjacentHTML("afterend",`<hr><table class="leaflet-rotate-info"><tr><td><button onclick="L.Rotate._map.setBearing(0);" title="map.setBearing(0);"> 0</button><button onclick="L.Rotate._map.setBearing(15);" title="map.setBearing(15);">15</button><button onclick="L.Rotate._map.setBearing(30);" title="map.setBearing(30);">30</button><button onclick="L.Rotate._map.setBearing(45);" title="map.setBearing(45);">45</button><button onclick="L.Rotate._map.setBearing(60);" title="map.setBearing(60);">60</button><button onclick="L.Rotate._map.setBearing(75);" title="map.setBearing(75);">75</button><button onclick="L.Rotate._map.setBearing(90);" title="map.setBearing(90);">90</button><button onclick="L.Rotate._map.setBearing(180);" title="map.setBearing(180);">180</button></td><td><input title="increase/decrease rotation angle" type="range" min="0" max="360" step="1" value="0" name="rho" id='rho_input' /><span id='rho'></span></td><td><input title="increase/decrease padding bounds" type="range" min="-0.25" max="0" value="0" step="0.01" name="pad" id='pad_input' /></td><td><button onclick="L.Rotate.randomRotateMarkers(L.Rotate._map);" title="markers.setRotation(Math.random() * Math.PI / 30 + 0.1)">Rotate Markers</button><button onclick="L.Rotate.randomMarkers(L.Rotate._map, 100);" title="add 100 random markers to map">Add Markers</button></td></tr><tr><th>LatLng </th><td id='llx'></td><td id='lly'></td><td class='long'>LatLng of mouse pointer</td></tr><tr><th>Rel to pane </th><td id='lyx'></td><td id='lyy'></td><td class='long'>Mouse pointer pixel coords relative to _rotatePane</td></tr><tr><th>Rel to container</th><td id='cnx'></td><td id='cny'></td><td class='long'>Mouse pointer coords relative to map <div></td></tr><tr><th>Pivot </th><td id='pvx'></td><td id='pvy'></td><td class='long'>Last _rotationPane pivot pixel coords relative to _rotationPane</td></tr><tr><th>Pane offset </th><td id='pox'></td><td id='poy'></td><td class='long'>Pixel offset of _mapPane</td></tr><tr><th>Pixel origin </th><td id='ogx'></td><td id='ogy'></td><td class='long'>Negative pixel coords of the (0,0) CRS point relative to _rotatePane</td></tr><tr><th>Pixel bounds </th><td id='ogbx'></td><td id='ogby'></td><td class='long'>Bounds of the current map view in projected pixel coordinates {min, max}.</td></tr></table>`),t.___rotatePixelOrigin=e.DomUtil.create("div","pixelorigin",t._rotatePane),t.___rotatePivotDot=e.DomUtil.create("div","pivot",t._mapPane),this.___rotateBounds=e.DomUtil.create("div","panebounds rotate",t._rotatePane),this.___mainBounds=e.DomUtil.create("div","panebounds main",t._mapPane),this.updatePaneBounds();const i=document.getElementById("rho_input"),o=document.getElementById("pad_input");if(i.addEventListener("change",e.Rotate.rotate.bind(this)),i.addEventListener("mousemove",e.Rotate.rotate.bind(this)),o.addEventListener("change",e.Rotate.displayCenter.bind(this)),o.addEventListener("mousemove",e.Rotate.displayCenter.bind(this)),o.addEventListener("change",e.Rotate.displayBounds.bind(this)),o.addEventListener("mousemove",e.Rotate.displayBounds.bind(this)),o.addEventListener("change",e.Rotate.displayLayersBounds.bind(this)),o.addEventListener("mousemove",e.Rotate.displayLayersBounds.bind(this)),o.addEventListener("change",e.Rotate.displayPixelBounds.bind(this)),o.addEventListener("mousemove",e.Rotate.displayPixelBounds.bind(this)),t.on("move rotate zoomend",this.updatePanePos),t.on("resize",this.updatePaneBounds.bind(this)),t.on("rotate zoomend load",this.updatePixelOrigin),t.on("rotate",this.updateRhoInput),t.on("rotate",this.updatePivotDot),t.on("moveend zoomend resetview rotate",this.displayCenter.bind(this)),t.on("moveend zoomend resetview rotate",this.displayBounds.bind(this)),t.on("moveend zoomend resetview rotate",this.displayLayersBounds.bind(this)),t.on("moveend zoomend resetview rotate",this.displayPixelBounds.bind(this)),this.updatePixelOrigin.call(t),this.updateRhoInput.call(t),this.updatePivotDot.call(t),this.displayCenter.call(this),this.displayBounds.call(this),this.displayLayersBounds.call(this),this.displayPixelBounds.call(this),e.Browser.mobile&&t.compassBearing.enable(),e.version.startsWith("2.")){const a=t.getContainer();a.addEventListener("mousemove",function(r){const s=a.getBoundingClientRect(),d=new e.Point(r.clientX-s.left-a.clientLeft,r.clientY-s.top-a.clientTop);e.Rotate.logMouse.call(t,{latlng:t.containerPointToLatLng(d),layerPoint:t.containerPointToLayerPoint(d),containerPoint:d})})}else t.on("mousemove",this.logMouse);t.on("locationfound",this.resetHeading),n.log&&t.on("click movestart move moveend zoomstart zoomend locationfound locationerror locationfound",this.logEvent)},logEvent(t){console.log(t,t.type)},logMouse(t){document.getElementById("llx").innerHTML=t.latlng.lng,document.getElementById("lly").innerHTML=t.latlng.lat,document.getElementById("lyx").innerHTML=t.layerPoint.x,document.getElementById("lyy").innerHTML=t.layerPoint.y,document.getElementById("cnx").innerHTML=t.containerPoint.x,document.getElementById("cny").innerHTML=t.containerPoint.y},rotate(t){return(t.type!=="mousemove"||t.buttons!==0)&&this._map.setBearing(t.target.valueAsNumber)},updatePaneBounds(){const t=this._map.getSize();for(const n of[this.___rotateBounds,this.___mainBounds])n.style.width=t.x+"px",n.style.height=t.y+"px"},updatePixelOrigin(){this._pixelOrigin&&(document.getElementById("ogx").innerHTML=this._pixelOrigin.x,document.getElementById("ogy").innerHTML=this._pixelOrigin.y,this.___rotatePixelOrigin.style.left=-this._pixelOrigin.x-1+"px",this.___rotatePixelOrigin.style.top=-this._pixelOrigin.y-1+"px")},updatePivotDot(){this._pivot&&(document.getElementById("pvx").innerHTML=this._pivot.x,document.getElementById("pvy").innerHTML=this._pivot.y,this.___rotatePivotDot.style.left=this._pivot.x-1+"px",this.___rotatePivotDot.style.top=this._pivot.y-1+"px")},updatePanePos(){const t=this._getMapPanePos();document.getElementById("pox").innerHTML=t.x,document.getElementById("poy").innerHTML=t.y},updateRhoInput(){document.getElementById("rho_input").value=this.getBearing()},rotateOneDegree(){const t=document.getElementById("rho_input").valueAsNumber++;this.setBearing(t<360?t:0)},randomRotateMarkers(t){const n=[],i=[];for(const a in t._layers)t._layers[a]instanceof e.Marker&&(n.push(t._layers[a]),i.push(Math.random()*Math.PI/30+.1));function o(a){for(let r=0;r<n.length;r++)n[r].setRotation(n[r].options.rotation+i[r]);--a&&setTimeout(o.bind(null,a),20)}o(25)},randomMarkers(t,n){t=this._map;const i=function(){for(let o=0;o<n;o++){const a=t.getBounds(),r=a.getSouthWest(),s=a.getNorthEast(),d=s.lng-r.lng,l=s.lat-r.lat,c=new e.Marker(new e.LatLng(r.lat+l*Math.random(),r.lng+d*Math.random()));e.Rotate.___cluster.addLayer(c)}};this.___cluster?typeof e.markerClusterGroup=="function"&&i():this.___cluster=import("https://unpkg.com/leaflet.markercluster@1.4.1/src/index.js").then(o=>{document.head.insertAdjacentHTML("beforeend",'<link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css"><link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css">'),Object.assign(globalThis.L,o),this.___cluster=e.markerClusterGroup({spiderfyOnMaxZoom:!1,showCoverageOnHover:!1,zoomToBoundsOnClick:!1}).on("clusterclick",a=>a.layer.spiderfy()).addTo(t),i()})},displayCenter(){const t=this._map;this.___centerMarker&&this.___centerMarker.remove(),this.___centerMarker=new e.CircleMarker(t.getCenter(),{radius:3,color:"red"}).addTo(t).bindTooltip("<b>center</b>",{direction:"right",permanent:!0}),this.___centerMarker.getTooltip().getElement().setAttribute("tabindex","-1")},displayBounds(){const t=this._map;this.___bounds&&this.___bounds.remove();const n=document.getElementById("pad_input").valueAsNumber,i=t.getBounds().pad(n);this.___bounds=new e.Rectangle(i,{fill:!1,lineCap:"square",color:"yellow",dashArray:"5, 10",weight:2}).addTo(t)},displayLayersBounds(){for(const t of["path","polygon","circle"]){if(globalThis[t])this[`___${t}bounds`]&&this[`___${t}bounds`].remove();else continue;const i=globalThis[t].getBounds();this[`___${t}bounds`]=new e.FeatureGroup([new e.Rectangle(i,{fill:!1,lineCap:"square",color:"yellow",dashArray:"5, 10",weight:1,opacity:.5}),new e.Marker(i.getNorthWest(),{scale:.5,rotation:-45*(Math.PI/180),rotateWithView:!0}).bindTooltip("<b>NW</b>",{direction:"center"}),new e.Marker(i.getNorthEast(),{scale:.5,rotation:45*(Math.PI/180),rotateWithView:!0}).bindTooltip("<b>NE</b>",{direction:"center"}),new e.Marker(i.getSouthEast(),{scale:.5,rotation:135*(Math.PI/180),rotateWithView:!0}).bindTooltip("<b>SE</b>",{direction:"center"}),new e.Marker(i.getSouthWest(),{scale:.5,rotation:-135*(Math.PI/180),rotateWithView:!0}).bindTooltip("<b>SW</b>",{direction:"center"})]).addTo(map).eachLayer(o=>{o.getElement&&o.getElement()&&(o.getElement().style.filter="hue-rotate(150deg)")})}},displayPixelBounds(){const t=this._map;this.___corners&&this.___corners.remove(),this.___pixelbounds&&this.___pixelbounds.remove();const n=t.getSize(),i=t.getPixelBounds(),o=new e.Point(0,0),a=new e.Point(n.x,0),r=new e.Point(n.x,n.y),s=new e.Point(0,n.y),d=new e.Marker(t.containerPointToLatLng(o),{title:"Top Left corner",rotation:-45*(Math.PI/180)}),l=new e.Marker(t.containerPointToLatLng(a),{title:"Top Right corner",rotation:45*(Math.PI/180)}),c=new e.Marker(t.containerPointToLatLng(r),{title:"Bottom Right corner",rotation:135*(Math.PI/180)}),h=new e.Marker(t.containerPointToLatLng(s),{title:"Bottom Left corner",rotation:-135*(Math.PI/180)});this.___corners=new e.FeatureGroup([d,l,c,h]).addTo(t).eachLayer(u=>u.getElement().style.filter="hue-rotate(150deg)"),document.getElementById("ogbx").innerHTML=JSON.stringify(i.min),document.getElementById("ogby").innerHTML=JSON.stringify(i.max)},resetHeading(t){t.heading!==null&&this.setBearing(t.heading)},locate(){this._map.locate({setView:!0,enableHighAccuracy:!0})}}})();
|
|
@@ -9,7 +9,7 @@ if (L.HeatLayer) {
|
|
|
9
9
|
const heatLayerAnimateZoom = L.HeatLayer.prototype._animateZoom;
|
|
10
10
|
|
|
11
11
|
L.HeatLayer.include({
|
|
12
|
-
onAdd
|
|
12
|
+
onAdd(map) {
|
|
13
13
|
heatLayerOnAdd.apply(this, arguments);
|
|
14
14
|
if (map._rotate) {
|
|
15
15
|
map.getPane('norotatePane').appendChild(this._canvas);
|
|
@@ -18,7 +18,7 @@ if (L.HeatLayer) {
|
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
20
|
|
|
21
|
-
onRemove
|
|
21
|
+
onRemove(map) {
|
|
22
22
|
if (map._rotate) {
|
|
23
23
|
map.off('rotate', this._reset, this);
|
|
24
24
|
map.getPane('overlayPane').appendChild(this._canvas);
|
|
@@ -26,7 +26,7 @@ if (L.HeatLayer) {
|
|
|
26
26
|
return heatLayerOnRemove.apply(this, arguments);
|
|
27
27
|
},
|
|
28
28
|
|
|
29
|
-
_reset
|
|
29
|
+
_reset() {
|
|
30
30
|
if (!this._map._rotate) {
|
|
31
31
|
return heatLayerReset.apply(this, arguments);
|
|
32
32
|
}
|
|
@@ -44,7 +44,7 @@ if (L.HeatLayer) {
|
|
|
44
44
|
this._redraw();
|
|
45
45
|
},
|
|
46
46
|
|
|
47
|
-
_animateZoom
|
|
47
|
+
_animateZoom(event) {
|
|
48
48
|
if (!this._map._rotate) {
|
|
49
49
|
return heatLayerAnimateZoom.apply(this, arguments);
|
|
50
50
|
}
|
|
@@ -66,7 +66,7 @@ if (globalThis.HeatmapOverlay) {
|
|
|
66
66
|
const heatmapDraw = globalThis.HeatmapOverlay.prototype._draw;
|
|
67
67
|
|
|
68
68
|
globalThis.HeatmapOverlay.include({
|
|
69
|
-
onAdd
|
|
69
|
+
onAdd(map) {
|
|
70
70
|
heatmapOnAdd.apply(this, arguments);
|
|
71
71
|
if (map._rotate) {
|
|
72
72
|
map.getPane('norotatePane').appendChild(this._el);
|
|
@@ -75,7 +75,7 @@ if (globalThis.HeatmapOverlay) {
|
|
|
75
75
|
}
|
|
76
76
|
},
|
|
77
77
|
|
|
78
|
-
onRemove
|
|
78
|
+
onRemove(map) {
|
|
79
79
|
if (map._rotate) {
|
|
80
80
|
map.off('rotate', this._draw, this);
|
|
81
81
|
map.getPane('overlayPane').appendChild(this._el);
|
|
@@ -83,7 +83,7 @@ if (globalThis.HeatmapOverlay) {
|
|
|
83
83
|
return heatmapOnRemove.apply(this, arguments);
|
|
84
84
|
},
|
|
85
85
|
|
|
86
|
-
_draw
|
|
86
|
+
_draw() {
|
|
87
87
|
const map = this._map;
|
|
88
88
|
if (!map._rotate) {
|
|
89
89
|
return heatmapDraw.apply(this, arguments);
|
package/misc/loremIpsum.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
globalThis.loremIpsum = "<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros. Nullam malesuada erat ut turpis. Suspendisse urna nibh, viverra non, semper suscipit, posuere a, pede.</p><p>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque.</p>";
|
package/misc/places.js
CHANGED