leaflet-rotate 0.2.8 → 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.
Files changed (48) hide show
  1. package/.github/workflows/ci.yml +21 -0
  2. package/README.md +6 -2
  3. package/build/build.js +69 -0
  4. package/build/dev.js +24 -0
  5. package/build/server.js +104 -0
  6. package/build/test.js +18 -0
  7. package/cucumber.mjs +5 -0
  8. package/dist/leaflet-rotate-src.js +1425 -1853
  9. package/dist/leaflet-rotate-src.js.map +7 -1
  10. package/dist/leaflet-rotate.js +1 -1
  11. package/dist/leaflet-rotate.js.map +7 -1
  12. package/lib/debug.js +98 -69
  13. package/lib/debug.min.js +1 -1
  14. package/misc/leaflet-heat-rotate.js +96 -0
  15. package/misc/loremIpsum.js +1 -1
  16. package/misc/places.js +1 -1
  17. package/misc/route.js +1 -1
  18. package/package.json +10 -17
  19. package/src/control/Rotate.js +25 -25
  20. package/src/dom/DomUtil.js +31 -47
  21. package/src/dom/Draggable.js +1 -1
  22. package/src/geometry/Point.js +16 -7
  23. package/src/layer/DivOverlay.js +21 -7
  24. package/src/layer/Popup.js +15 -13
  25. package/src/layer/Tooltip.js +5 -5
  26. package/src/layer/marker/Icon.js +8 -8
  27. package/src/layer/marker/Marker.js +32 -18
  28. package/src/layer/tile/GridLayer.js +4 -4
  29. package/src/layer/vector/Renderer.js +51 -7
  30. package/src/map/Map.js +121 -57
  31. package/src/map/handler/CompassBearing.js +10 -8
  32. package/src/map/handler/ContainerMutation.js +2 -2
  33. package/src/map/handler/ShiftKeyRotate.js +4 -4
  34. package/src/map/handler/TouchGestures.js +36 -22
  35. package/src/map/handler/TouchRotate.js +2 -2
  36. package/src/map/handler/TouchZoom.js +4 -4
  37. package/test/features/example.feature +92 -0
  38. package/test/features/gestures.feature +33 -0
  39. package/test/features/overlays.feature +58 -0
  40. package/test/features/rotation.feature +36 -0
  41. package/test/index.html +59 -22
  42. package/test/steps/bearing.steps.js +235 -0
  43. package/test/steps/example.steps.js +424 -0
  44. package/test/steps/gestures.steps.js +145 -0
  45. package/test/steps/overlays.steps.js +427 -0
  46. package/test/support/hooks.js +92 -0
  47. package/build/rollup.config.js +0 -34
  48. package/test/setup/http_server.js +0 -104
package/lib/debug.js CHANGED
@@ -1,6 +1,9 @@
1
- L.Rotate = {
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: function(map, options = {}) {
6
+ debug(map, options = {}) {
4
7
 
5
8
  this._map = map;
6
9
 
@@ -64,6 +67,7 @@ L.Rotate = {
64
67
  position:absolute;
65
68
  width:800px;
66
69
  height:600px;
70
+ box-sizing: border-box;
67
71
  border: 1px solid red;
68
72
  border-bottom: 1px red dashed;
69
73
  border-right: 1px red dashed;
@@ -73,6 +77,7 @@ L.Rotate = {
73
77
  position:absolute;
74
78
  width:800px;
75
79
  height:600px;
80
+ box-sizing: border-box;
76
81
  border: 1px solid purple;
77
82
  border-bottom: 1px purple dashed;
78
83
  border-right: 1px purple dashed;
@@ -181,11 +186,12 @@ L.Rotate = {
181
186
  map.___rotatePixelOrigin = L.DomUtil.create('div', 'pixelorigin', map._rotatePane);
182
187
  map.___rotatePivotDot = L.DomUtil.create('div', 'pivot', map._mapPane);
183
188
 
184
- L.DomUtil.create('div', 'panebounds rotate', map._rotatePane);
185
- L.DomUtil.create('div', 'panebounds main', map._mapPane);
189
+ this.___rotateBounds = L.DomUtil.create('div', 'panebounds rotate', map._rotatePane);
190
+ this.___mainBounds = L.DomUtil.create('div', 'panebounds main', map._mapPane);
191
+ this.updatePaneBounds();
186
192
 
187
- var rhoInput = document.getElementById('rho_input');
188
- var padInput = document.getElementById('pad_input');
193
+ const rhoInput = document.getElementById('rho_input');
194
+ const padInput = document.getElementById('pad_input');
189
195
 
190
196
  rhoInput.addEventListener('change', L.Rotate.rotate.bind(this));
191
197
  rhoInput.addEventListener('mousemove', L.Rotate.rotate.bind(this));
@@ -200,6 +206,7 @@ L.Rotate = {
200
206
  padInput.addEventListener('mousemove', L.Rotate.displayPixelBounds.bind(this));
201
207
 
202
208
  map.on('move rotate zoomend', this.updatePanePos);
209
+ map.on('resize', this.updatePaneBounds.bind(this));
203
210
  map.on('rotate zoomend load', this.updatePixelOrigin);
204
211
  map.on('rotate', this.updateRhoInput);
205
212
  map.on('rotate', this.updatePivotDot);
@@ -220,7 +227,23 @@ L.Rotate = {
220
227
  map.compassBearing.enable();
221
228
  }
222
229
 
223
- map.on('mousemove', this.logMouse);
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
+ }
224
247
  map.on('locationfound', this.resetHeading);
225
248
 
226
249
  if (options.log) {
@@ -232,11 +255,11 @@ L.Rotate = {
232
255
 
233
256
  },
234
257
 
235
- logEvent: function(e) {
258
+ logEvent(e) {
236
259
  console.log(e, e.type);
237
260
  },
238
261
 
239
- logMouse: function(e) {
262
+ logMouse(e) {
240
263
  document.getElementById('llx').innerHTML = e.latlng.lng;
241
264
  document.getElementById('lly').innerHTML = e.latlng.lat;
242
265
  document.getElementById('lyx').innerHTML = e.layerPoint.x;
@@ -248,14 +271,22 @@ L.Rotate = {
248
271
  /**
249
272
  * Debug L.Map.setBearing()
250
273
  */
251
- rotate: function(e) {
252
- return e.buttons !== 0 && this._map.setBearing(e.target.valueAsNumber);
274
+ rotate(e) {
275
+ return (e.type !== 'mousemove' || e.buttons !== 0) && this._map.setBearing(e.target.valueAsNumber);
276
+ },
277
+
278
+ updatePaneBounds() {
279
+ const size = this._map.getSize();
280
+ for (const bounds of [this.___rotateBounds, this.___mainBounds]) {
281
+ bounds.style.width = size.x + 'px';
282
+ bounds.style.height = size.y + 'px';
283
+ }
253
284
  },
254
285
 
255
286
  /**
256
287
  * Debug L.Map._pixelOrigin
257
288
  */
258
- updatePixelOrigin: function() {
289
+ updatePixelOrigin() {
259
290
  if (this._pixelOrigin) {
260
291
  document.getElementById('ogx').innerHTML = this._pixelOrigin.x;
261
292
  document.getElementById('ogy').innerHTML = this._pixelOrigin.y;
@@ -267,7 +298,7 @@ L.Rotate = {
267
298
  /**
268
299
  * Debug L.Map._pivot
269
300
  */
270
- updatePivotDot: function() {
301
+ updatePivotDot() {
271
302
  if (this._pivot) {
272
303
  document.getElementById('pvx').innerHTML = this._pivot.x;
273
304
  document.getElementById('pvy').innerHTML = this._pivot.y;
@@ -279,8 +310,8 @@ L.Rotate = {
279
310
  /**
280
311
  * Debug L.Map._getMapPanePos()
281
312
  */
282
- updatePanePos: function() {
283
- var panePos = this._getMapPanePos();
313
+ updatePanePos() {
314
+ const panePos = this._getMapPanePos();
284
315
  document.getElementById('pox').innerHTML = panePos.x;
285
316
  document.getElementById('poy').innerHTML = panePos.y;
286
317
  },
@@ -288,26 +319,26 @@ L.Rotate = {
288
319
  /**
289
320
  * Debug L.Map.getBearing()
290
321
  */
291
- updateRhoInput: function() {
322
+ updateRhoInput() {
292
323
  document.getElementById('rho_input').value = this.getBearing();
293
324
  },
294
325
 
295
326
  /**
296
327
  * Debug L.Map.setBearing()
297
328
  */
298
- rotateOneDegree: function() {
299
- var angle = document.getElementById('rho_input').valueAsNumber++;
329
+ rotateOneDegree() {
330
+ const angle = document.getElementById('rho_input').valueAsNumber++;
300
331
  this.setBearing(angle < 360 ? angle : 0);
301
332
  },
302
333
 
303
334
  /**
304
335
  * Debug L.Marker.setRotation()
305
336
  */
306
- randomRotateMarkers: function(map) {
307
- var markers = [],
337
+ randomRotateMarkers(map) {
338
+ const markers = [],
308
339
  steps = [];
309
340
 
310
- for (var i in map._layers) {
341
+ for (const i in map._layers) {
311
342
  if (map._layers[i] instanceof L.Marker) {
312
343
  markers.push(map._layers[i]);
313
344
  steps.push(Math.random() * Math.PI / 30 + 0.1);
@@ -315,7 +346,7 @@ L.Rotate = {
315
346
  }
316
347
 
317
348
  function stepOn(steps_left) {
318
- for (var i = 0; i < markers.length; i++) {
349
+ for (let i = 0; i < markers.length; i++) {
319
350
  markers[i].setRotation(markers[i].options.rotation + steps[i]);
320
351
  }
321
352
  if (--steps_left) setTimeout(stepOn.bind(null, steps_left), 20);
@@ -327,17 +358,17 @@ L.Rotate = {
327
358
  /**
328
359
  * Debug L.Map.panInside()
329
360
  */
330
- randomMarkers: function(map, number) {
331
- var map = this._map;
332
- var populate = function() {
361
+ randomMarkers(map, number) {
362
+ map = this._map;
363
+ const populate = function() {
333
364
  // populate map with a cluster of random markers
334
- for (var i = 0; i < number; i++) {
335
- var bounds = map.getBounds();
336
- var southWest = bounds.getSouthWest();
337
- var northEast = bounds.getNorthEast();
338
- var lngSpan = northEast.lng - southWest.lng;
339
- var latSpan = northEast.lat - southWest.lat;
340
- var m = L.marker( L.latLng(southWest.lat + latSpan * Math.random(), southWest.lng + lngSpan * Math.random()) );
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()));
341
372
  // m.addTo(L.Rotate._map);
342
373
  L.Rotate.___cluster.addLayer(m);
343
374
  }
@@ -369,12 +400,12 @@ L.Rotate = {
369
400
  /**
370
401
  * Debug L.Map.getCenter()
371
402
  */
372
- displayCenter: function() {
373
- var map = this._map;
403
+ displayCenter() {
404
+ const map = this._map;
374
405
  if (this.___centerMarker) {
375
406
  this.___centerMarker.remove();
376
407
  }
377
- this.___centerMarker = L.circleMarker(map.getCenter(), {
408
+ this.___centerMarker = new L.CircleMarker(map.getCenter(), {
378
409
  radius: 3,
379
410
  color: 'red',
380
411
  }).addTo(map).bindTooltip('<b>center</b>', { direction: 'right', permanent: true, });
@@ -384,15 +415,15 @@ L.Rotate = {
384
415
  /**
385
416
  * Debug L.Map.getCenter()
386
417
  */
387
- displayBounds: function() {
388
- var map = this._map;
418
+ displayBounds() {
419
+ const map = this._map;
389
420
  if (this.___bounds) {
390
421
  this.___bounds.remove();
391
422
  }
392
423
 
393
- var padding = document.getElementById('pad_input').valueAsNumber;
394
- var latLngBounds = map.getBounds().pad(padding)
395
- this.___bounds = L.rectangle(latLngBounds, {
424
+ const padding = document.getElementById('pad_input').valueAsNumber;
425
+ const latLngBounds = map.getBounds().pad(padding)
426
+ this.___bounds = new L.Rectangle(latLngBounds, {
396
427
  fill: false,
397
428
  lineCap: 'square',
398
429
  color: 'yellow',
@@ -405,17 +436,17 @@ L.Rotate = {
405
436
  /**
406
437
  * DEBUG: map.flyToBounds(path.getBounds())
407
438
  */
408
- displayLayersBounds: function() {
439
+ displayLayersBounds() {
409
440
  for (const flytopath of ['path', 'polygon', 'circle']) {
410
441
  if (!globalThis[flytopath]) {
411
442
  continue;
412
443
  } else if (this[`___${flytopath}bounds`]) {
413
444
  this[`___${flytopath}bounds`].remove();
414
445
  }
415
- let layer = globalThis[flytopath];
416
- let layerBounds = layer.getBounds();
417
- this[`___${flytopath}bounds`] = L.featureGroup([
418
- L.rectangle(layerBounds, {
446
+ const layer = globalThis[flytopath];
447
+ const layerBounds = layer.getBounds();
448
+ this[`___${flytopath}bounds`] = new L.FeatureGroup([
449
+ new L.Rectangle(layerBounds, {
419
450
  fill: false,
420
451
  lineCap: 'square',
421
452
  color: 'yellow',
@@ -423,10 +454,10 @@ L.Rotate = {
423
454
  weight: 1,
424
455
  opacity: 0.5
425
456
  }),
426
- L.marker(layerBounds.getNorthWest(), { scale: 0.5, rotation: -45 * L.DomUtil.DEG_TO_RAD, rotateWithView: true }).bindTooltip('<b>NW</b>', {direction: 'center'}),
427
- L.marker(layerBounds.getNorthEast(), { scale: 0.5, rotation: 45 * L.DomUtil.DEG_TO_RAD, rotateWithView: true }).bindTooltip('<b>NE</b>', {direction: 'center'}),
428
- L.marker(layerBounds.getSouthEast(), { scale: 0.5, rotation: 135 * L.DomUtil.DEG_TO_RAD, rotateWithView: true }).bindTooltip('<b>SE</b>', {direction: 'center'}),
429
- L.marker(layerBounds.getSouthWest(), { scale: 0.5, rotation: -135 * L.DomUtil.DEG_TO_RAD, rotateWithView: true }).bindTooltip('<b>SW</b>', {direction: 'center'}),
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'}),
430
461
  ]).addTo(map).eachLayer(m => { if (m.getElement && m.getElement()) m.getElement().style.filter = 'hue-rotate(150deg)'; });
431
462
  }
432
463
  },
@@ -434,26 +465,23 @@ L.Rotate = {
434
465
  /**
435
466
  * @TODO Debug L.Map.getPixelBounds()
436
467
  */
437
- displayPixelBounds: function() {
438
- var map = this._map;
468
+ displayPixelBounds() {
469
+ const map = this._map;
439
470
  this.___corners && this.___corners.remove();
440
471
  this.___pixelbounds && this.___pixelbounds.remove();
441
472
 
442
473
  const size = map.getSize();
443
- const rect = map._container.getBoundingClientRect();
444
474
  const pixelBounds = map.getPixelBounds();
445
475
 
446
- const TL = L.point(rect);
447
- const TR = L.point(rect).add(L.point(rect.width, 0));
448
- const BR = L.point(rect).add(L.point(rect.width, rect.height))
449
- const BL = L.point(rect).add(L.point(0, rect.height));
450
-
451
- const topLeft = L.marker( map.containerPointToLatLng(TL), { title: 'Top Left corner', rotation: -45 * L.DomUtil.DEG_TO_RAD } );
452
- const topRight = L.marker( map.containerPointToLatLng(TR), { title: 'Top Right corner', rotation: 45 * L.DomUtil.DEG_TO_RAD } );
453
- const bottomRight = L.marker( map.containerPointToLatLng(BR), { title: 'Bottom Right corner', rotation: 135 * L.DomUtil.DEG_TO_RAD } );
454
- const bottomLeft = L.marker( map.containerPointToLatLng(BL), { title: 'Bottom Left corner', rotation: -135 * L.DomUtil.DEG_TO_RAD } );
455
-
456
- 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)');
457
485
 
458
486
  // L.polyline([
459
487
  // [topLeft.getLatLng(), topRight.getLatLng()],
@@ -493,9 +521,9 @@ L.Rotate = {
493
521
  // map.layerPointToLatLng([0, size.y]), // bottomleft
494
522
  // ]);
495
523
 
496
- // const paddingTL = L.point(L.Marker.prototype.options.icon.options.iconAnchor || [0, 0]),
497
- // paddingBR = L.point(L.Marker.prototype.options.icon.options.iconSize || [0, 0]).subtract(paddingTL),
498
- // pixelBounds = L.bounds([ L.point(rect), L.point(rect).add(map.getSize()) ]),
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()) ]),
499
527
  // paddedBounds = L.latLngBounds([
500
528
  // map.layerPointToLatLng(pixelBounds.min.add(paddingTL)),
501
529
  // map.layerPointToLatLng(pixelBounds.max.subtract(paddingBR))
@@ -506,7 +534,7 @@ L.Rotate = {
506
534
  document.getElementById('ogby').innerHTML = JSON.stringify(pixelBounds.max);
507
535
  },
508
536
 
509
- resetHeading: function(e) {
537
+ resetHeading(e) {
510
538
  if (e.heading !== null) {
511
539
  this.setBearing(e.heading);
512
540
  }
@@ -515,11 +543,12 @@ L.Rotate = {
515
543
  /**
516
544
  * Debug L.Map.locate()
517
545
  */
518
- locate: function() {
546
+ locate() {
519
547
  this._map.locate({
520
548
  setView: true,
521
549
  enableHighAccuracy: true
522
550
  });
523
551
  }
524
552
 
525
- };
553
+ };
554
+ })();
package/lib/debug.min.js CHANGED
@@ -1 +1 @@
1
- L.Rotate={debug:function(map,options={}){this._map=map,document.head.insertAdjacentHTML("beforeend","<style>\n .leaflet-rotate-info {\n width: 100%;\n }\n .leaflet-rotate-info td {\n /* width: 7em; */\n overflow: hidden;\n /* max-width: 7em; */\n text-overflow: ellipsis;\n /* white-space: nowrap; */\n }\n .leaflet-rotate-info td:nth-of-type(3) {\n font-family: Monospace;\n }\n .leaflet-rotate-info th {\n text-align: left;\n }\n div.crosshair {\n position:absolute;\n width:1px;\n height:1px;\n border: 1px solid green;\n z-index: 100;\n left: 50%;\n right: 50%;\n }\n div.pivot {\n position:absolute;\n width:1px;\n height:1px;\n border: 5px solid yellow;\n border-radius: 100%;\n z-index: 1000;\n }\n div.pixelorigin {\n position: absolute;\n width: 1px;\n height: 1px;\n border: 5px solid yellow;\n border-radius: 100%;\n z-index: 1000;\n }\n div.pivot:before {\n left: -1.5em;\n bottom: -2em;\n position: absolute;\n content: 'PIVOT';\n color: yellow;\n }\n div.pixelorigin:before {\n left: -1.75em;\n top: -2em;\n position: absolute;\n content: 'ORIGIN';\n color: yellow;\n }\n div.panebounds.main {\n position:absolute;\n width:800px;\n height:600px;\n border: 1px solid red;\n border-bottom: 1px red dashed;\n border-right: 1px red dashed;\n z-index: 100;\n }\n div.panebounds.rotate {\n position:absolute;\n width:800px;\n height:600px;\n border: 1px solid purple;\n border-bottom: 1px purple dashed;\n border-right: 1px purple dashed;\n z-index: 100;\n }\n div.crosshair.c1 {\n left:calc(50% - 5px);\n top:50%;\n height: 0;\n width: 10px;\n }\n div.crosshair.c2 {\n left:50%;\n top:calc(50% - 5px);\n width: 0;\n height: 10px;\n }\n #rho_input {\n vertical-align: middle;\n }\n .panebounds:before {\n padding: 1ch;\n }\n .panebounds.rotate:before {\n float: right;\n content: 'ROTATED';\n }\n .panebounds.main:before {\n float: left;\n content: 'MAIN';\n }\n </style>"),map._container.insertAdjacentHTML("afterbegin",'<div class="crosshair c1"></div><div class="crosshair c2"></div>'),map._container.insertAdjacentHTML("afterend",'<hr>\n <table class="leaflet-rotate-info">\n <tr>\n <td>\n <button onclick="L.Rotate._map.setBearing(0);" title="map.setBearing(0);"> 0</button>\n <button onclick="L.Rotate._map.setBearing(15);" title="map.setBearing(15);">15</button>\n <button onclick="L.Rotate._map.setBearing(30);" title="map.setBearing(30);">30</button>\n <button onclick="L.Rotate._map.setBearing(45);" title="map.setBearing(45);">45</button>\n <button onclick="L.Rotate._map.setBearing(60);" title="map.setBearing(60);">60</button>\n <button onclick="L.Rotate._map.setBearing(75);" title="map.setBearing(75);">75</button>\n <button onclick="L.Rotate._map.setBearing(90);" title="map.setBearing(90);">90</button>\n <button onclick="L.Rotate._map.setBearing(180);" title="map.setBearing(180);">180</button>\n </td>\n <td>\n <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>\n </td>\n <td>\n <input title="increase/decrease padding bounds" type="range" min="-0.25" max="0" value="0" step="0.01" name="pad" id=\'pad_input\' />\n </td>\n <td>\n <button onclick="L.Rotate.randomRotateMarkers(L.Rotate._map);" title="markers.setRotation(Math.random() * Math.PI / 30 + 0.1)">Rotate Markers</button>\n <button onclick="L.Rotate.randomMarkers(L.Rotate._map, 100);" title="add 100 random markers to map">Add Markers</button>\n </td>\n </tr>\n <tr>\n <th>LatLng </th>\n <td id=\'llx\'></td>\n <td id=\'lly\'></td>\n <td class=\'long\'>LatLng of mouse pointer</td>\n </tr>\n <tr>\n <th>Rel to pane </th>\n <td id=\'lyx\'></td>\n <td id=\'lyy\'></td>\n <td class=\'long\'>Mouse pointer pixel coords relative to _rotatePane</td>\n </tr>\n <tr>\n <th>Rel to container</th>\n <td id=\'cnx\'></td>\n <td id=\'cny\'></td>\n <td class=\'long\'>Mouse pointer coords relative to map &lt;div&gt;</td>\n </tr>\n <tr>\n <th>Pivot </th>\n <td id=\'pvx\'></td>\n <td id=\'pvy\'></td>\n <td class=\'long\'>Last _rotationPane pivot pixel coords relative to _rotationPane</td>\n </tr>\n <tr>\n <th>Pane offset </th>\n <td id=\'pox\'></td>\n <td id=\'poy\'></td>\n <td class=\'long\'>Pixel offset of _mapPane</td>\n </tr>\n <tr>\n <th>Pixel origin </th>\n <td id=\'ogx\'></td>\n <td id=\'ogy\'></td>\n <td class=\'long\'>Negative pixel coords of the (0,0) CRS point relative to _rotatePane</td>\n </tr>\n <tr>\n <th>Pixel bounds </th>\n <td id=\'ogbx\'></td>\n <td id=\'ogby\'></td>\n <td class=\'long\'>Bounds of the current map view in projected pixel coordinates {min, max}.</td>\n </tr>\n </table>'),map.___rotatePixelOrigin=L.DomUtil.create("div","pixelorigin",map._rotatePane),map.___rotatePivotDot=L.DomUtil.create("div","pivot",map._mapPane),L.DomUtil.create("div","panebounds rotate",map._rotatePane),L.DomUtil.create("div","panebounds main",map._mapPane);var rhoInput=document.getElementById("rho_input"),padInput=document.getElementById("pad_input");rhoInput.addEventListener("change",L.Rotate.rotate.bind(this)),rhoInput.addEventListener("mousemove",L.Rotate.rotate.bind(this)),padInput.addEventListener("change",L.Rotate.displayCenter.bind(this)),padInput.addEventListener("mousemove",L.Rotate.displayCenter.bind(this)),padInput.addEventListener("change",L.Rotate.displayBounds.bind(this)),padInput.addEventListener("mousemove",L.Rotate.displayBounds.bind(this)),padInput.addEventListener("change",L.Rotate.displayLayersBounds.bind(this)),padInput.addEventListener("mousemove",L.Rotate.displayLayersBounds.bind(this)),padInput.addEventListener("change",L.Rotate.displayPixelBounds.bind(this)),padInput.addEventListener("mousemove",L.Rotate.displayPixelBounds.bind(this)),map.on("move rotate zoomend",this.updatePanePos),map.on("rotate zoomend load",this.updatePixelOrigin),map.on("rotate",this.updateRhoInput),map.on("rotate",this.updatePivotDot),map.on("moveend zoomend resetview rotate",this.displayCenter.bind(this)),map.on("moveend zoomend resetview rotate",this.displayBounds.bind(this)),map.on("moveend zoomend resetview rotate",this.displayLayersBounds.bind(this)),map.on("moveend zoomend resetview rotate",this.displayPixelBounds.bind(this)),this.updatePixelOrigin.call(map),this.updateRhoInput.call(map),this.updatePivotDot.call(map),this.displayCenter.call(this),this.displayBounds.call(this),this.displayLayersBounds.call(this),this.displayPixelBounds.call(this),L.Browser.mobile&&map.compassBearing.enable(),map.on("mousemove",this.logMouse),map.on("locationfound",this.resetHeading),options.log&&map.on("click movestart move moveend zoomstart zoomend locationfound locationerror locationfound",this.logEvent)},logEvent:function(e){console.log(e,e.type)},logMouse:function(e){document.getElementById("llx").innerHTML=e.latlng.lng,document.getElementById("lly").innerHTML=e.latlng.lat,document.getElementById("lyx").innerHTML=e.layerPoint.x,document.getElementById("lyy").innerHTML=e.layerPoint.y,document.getElementById("cnx").innerHTML=e.containerPoint.x,document.getElementById("cny").innerHTML=e.containerPoint.y},rotate:function(e){return 0!==e.buttons&&this._map.setBearing(e.target.valueAsNumber)},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 panePos=this._getMapPanePos();document.getElementById("pox").innerHTML=panePos.x,document.getElementById("poy").innerHTML=panePos.y},updateRhoInput:function(){document.getElementById("rho_input").value=this.getBearing()},rotateOneDegree:function(){var angle=document.getElementById("rho_input").valueAsNumber++;this.setBearing(angle<360?angle:0)},randomRotateMarkers:function(map){var markers=[],steps=[];for(var i in map._layers)map._layers[i]instanceof L.Marker&&(markers.push(map._layers[i]),steps.push(Math.random()*Math.PI/30+.1));function stepOn(steps_left){for(var i=0;i<markers.length;i++)markers[i].setRotation(markers[i].options.rotation+steps[i]);--steps_left&&setTimeout(stepOn.bind(null,steps_left),20)}stepOn(25)},randomMarkers:function(map,number){var map=this._map,populate=function(){for(var i=0;i<number;i++){var bounds=map.getBounds(),southWest=bounds.getSouthWest(),northEast=bounds.getNorthEast(),lngSpan=northEast.lng-southWest.lng,latSpan=northEast.lat-southWest.lat,m=L.marker(L.latLng(southWest.lat+latSpan*Math.random(),southWest.lng+lngSpan*Math.random()));L.Rotate.___cluster.addLayer(m)}};this.___cluster?"function"==typeof L.markerClusterGroup&&populate():this.___cluster=import("https://unpkg.com/leaflet.markercluster@1.4.1/src/index.js").then(m=>{document.head.insertAdjacentHTML("beforeend",'\n \x3c!-- Leaflet-MarkerCluster --\x3e\n <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.css">\n <link rel="stylesheet" href="https://unpkg.com/leaflet.markercluster@1.4.1/dist/MarkerCluster.Default.css">\n '),Object.assign(globalThis.L,m),this.___cluster=L.markerClusterGroup({spiderfyOnMaxZoom:!1,showCoverageOnHover:!1,zoomToBoundsOnClick:!1}).on("clusterclick",a=>a.layer.spiderfy()).addTo(map),populate()})},displayCenter:function(){var map=this._map;this.___centerMarker&&this.___centerMarker.remove(),this.___centerMarker=L.circleMarker(map.getCenter(),{radius:3,color:"red"}).addTo(map).bindTooltip("<b>center</b>",{direction:"right",permanent:!0}),this.___centerMarker.getTooltip().getElement().setAttribute("tabindex","-1")},displayBounds:function(){var map=this._map;this.___bounds&&this.___bounds.remove();var padding=document.getElementById("pad_input").valueAsNumber,latLngBounds=map.getBounds().pad(padding);this.___bounds=L.rectangle(latLngBounds,{fill:!1,lineCap:"square",color:"yellow",dashArray:"5, 10",weight:2}).addTo(map)},displayLayersBounds:function(){for(const flytopath of["path","polygon","circle"]){if(!globalThis[flytopath])continue;this[`___${flytopath}bounds`]&&this[`___${flytopath}bounds`].remove();let layer,layerBounds=globalThis[flytopath].getBounds();this[`___${flytopath}bounds`]=L.featureGroup([L.rectangle(layerBounds,{fill:!1,lineCap:"square",color:"yellow",dashArray:"5, 10",weight:1,opacity:.5}),L.marker(layerBounds.getNorthWest(),{scale:.5,rotation:-45*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>NW</b>",{direction:"center"}),L.marker(layerBounds.getNorthEast(),{scale:.5,rotation:45*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>NE</b>",{direction:"center"}),L.marker(layerBounds.getSouthEast(),{scale:.5,rotation:135*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>SE</b>",{direction:"center"}),L.marker(layerBounds.getSouthWest(),{scale:.5,rotation:-135*L.DomUtil.DEG_TO_RAD,rotateWithView:!0}).bindTooltip("<b>SW</b>",{direction:"center"})]).addTo(map).eachLayer(m=>{m.getElement&&m.getElement()&&(m.getElement().style.filter="hue-rotate(150deg)")})}},displayPixelBounds:function(){var map=this._map;this.___corners&&this.___corners.remove(),this.___pixelbounds&&this.___pixelbounds.remove();const size=map.getSize(),rect=map._container.getBoundingClientRect(),pixelBounds=map.getPixelBounds(),TL=L.point(rect),TR=L.point(rect).add(L.point(rect.width,0)),BR=L.point(rect).add(L.point(rect.width,rect.height)),BL=L.point(rect).add(L.point(0,rect.height)),topLeft=L.marker(map.containerPointToLatLng(TL),{title:"Top Left corner",rotation:-45*L.DomUtil.DEG_TO_RAD}),topRight=L.marker(map.containerPointToLatLng(TR),{title:"Top Right corner",rotation:45*L.DomUtil.DEG_TO_RAD}),bottomRight=L.marker(map.containerPointToLatLng(BR),{title:"Bottom Right corner",rotation:135*L.DomUtil.DEG_TO_RAD}),bottomLeft=L.marker(map.containerPointToLatLng(BL),{title:"Bottom Left corner",rotation:-135*L.DomUtil.DEG_TO_RAD});this.___corners=L.featureGroup([topLeft,topRight,bottomRight,bottomLeft]).addTo(map).eachLayer(marker=>marker.getElement().style.filter="hue-rotate(150deg)"),document.getElementById("ogbx").innerHTML=JSON.stringify(pixelBounds.min),document.getElementById("ogby").innerHTML=JSON.stringify(pixelBounds.max)},resetHeading:function(e){null!==e.heading&&this.setBearing(e.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 &lt;div&gt;</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})}}})();
@@ -0,0 +1,96 @@
1
+ if (!L.HeatLayer && !globalThis.HeatmapOverlay) {
2
+ throw new Error('Load Leaflet.heat or heatmap.js Leaflet plugin before this adapter.');
3
+ }
4
+
5
+ if (L.HeatLayer) {
6
+ const heatLayerOnAdd = L.HeatLayer.prototype.onAdd;
7
+ const heatLayerOnRemove = L.HeatLayer.prototype.onRemove;
8
+ const heatLayerReset = L.HeatLayer.prototype._reset;
9
+ const heatLayerAnimateZoom = L.HeatLayer.prototype._animateZoom;
10
+
11
+ L.HeatLayer.include({
12
+ onAdd(map) {
13
+ heatLayerOnAdd.apply(this, arguments);
14
+ if (map._rotate) {
15
+ map.getPane('norotatePane').appendChild(this._canvas);
16
+ this._reset();
17
+ map.on('rotate', this._reset, this);
18
+ }
19
+ },
20
+
21
+ onRemove(map) {
22
+ if (map._rotate) {
23
+ map.off('rotate', this._reset, this);
24
+ map.getPane('overlayPane').appendChild(this._canvas);
25
+ }
26
+ return heatLayerOnRemove.apply(this, arguments);
27
+ },
28
+
29
+ _reset() {
30
+ if (!this._map._rotate) {
31
+ return heatLayerReset.apply(this, arguments);
32
+ }
33
+
34
+ const map = this._map;
35
+ const size = map.getSize();
36
+ L.DomUtil.setPosition(this._canvas, map._getMapPanePos().multiplyBy(-1));
37
+
38
+ if (this._heat._width !== size.x) {
39
+ this._canvas.width = this._heat._width = size.x;
40
+ }
41
+ if (this._heat._height !== size.y) {
42
+ this._canvas.height = this._heat._height = size.y;
43
+ }
44
+ this._redraw();
45
+ },
46
+
47
+ _animateZoom(event) {
48
+ if (!this._map._rotate) {
49
+ return heatLayerAnimateZoom.apply(this, arguments);
50
+ }
51
+
52
+ const map = this._map;
53
+ const scale = map.getZoomScale(event.zoom);
54
+ const offset = map._getCenterOffset(event.center)
55
+ .rotate(map._bearing)
56
+ .multiplyBy(-scale)
57
+ .subtract(map._getMapPanePos());
58
+ L.DomUtil.setTransform(this._canvas, offset, scale);
59
+ },
60
+ });
61
+ }
62
+
63
+ if (globalThis.HeatmapOverlay) {
64
+ const heatmapOnAdd = globalThis.HeatmapOverlay.prototype.onAdd;
65
+ const heatmapOnRemove = globalThis.HeatmapOverlay.prototype.onRemove;
66
+ const heatmapDraw = globalThis.HeatmapOverlay.prototype._draw;
67
+
68
+ globalThis.HeatmapOverlay.include({
69
+ onAdd(map) {
70
+ heatmapOnAdd.apply(this, arguments);
71
+ if (map._rotate) {
72
+ map.getPane('norotatePane').appendChild(this._el);
73
+ this._draw();
74
+ map.on('rotate', this._draw, this);
75
+ }
76
+ },
77
+
78
+ onRemove(map) {
79
+ if (map._rotate) {
80
+ map.off('rotate', this._draw, this);
81
+ map.getPane('overlayPane').appendChild(this._el);
82
+ }
83
+ return heatmapOnRemove.apply(this, arguments);
84
+ },
85
+
86
+ _draw() {
87
+ const map = this._map;
88
+ if (!map._rotate) {
89
+ return heatmapDraw.apply(this, arguments);
90
+ }
91
+
92
+ L.DomUtil.setPosition(this._el, map._getMapPanePos().multiplyBy(-1));
93
+ this._update();
94
+ },
95
+ });
96
+ }
@@ -1 +1 @@
1
- var 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>";
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
@@ -1,4 +1,4 @@
1
- var places = {
1
+ globalThis.places = {
2
2
  'Kyiv': [50.5, 30.5],
3
3
  'London': [51.51, -0.12],
4
4
  'San Francisco': [37.77, -122.42],