leaflet-rotate 0.3.0 → 0.5.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 (42) hide show
  1. package/README.md +74 -5
  2. package/build/test.js +18 -0
  3. package/dist/leaflet-rotate-src.js +1081 -303
  4. package/dist/leaflet-rotate-src.js.map +3 -3
  5. package/dist/leaflet-rotate.js +1 -1
  6. package/dist/leaflet-rotate.js.map +3 -3
  7. package/lib/debug.js +84 -66
  8. package/lib/debug.min.js +1 -1
  9. package/misc/leaflet-heat-rotate.js +14 -7
  10. package/misc/loremIpsum.js +1 -1
  11. package/misc/places.js +1 -1
  12. package/misc/route.js +1 -1
  13. package/package.json +5 -5
  14. package/src/control/Rotate.js +98 -29
  15. package/src/dom/DomUtil.js +42 -47
  16. package/src/dom/Draggable.js +6 -1
  17. package/src/geo/LatLngBounds.js +5 -0
  18. package/src/geometry/Bounds.js +5 -0
  19. package/src/geometry/Point.js +33 -10
  20. package/src/index.js +3 -1
  21. package/src/layer/DivOverlay.js +43 -12
  22. package/src/layer/Popup.js +29 -16
  23. package/src/layer/Tooltip.js +21 -5
  24. package/src/layer/marker/Icon.js +20 -8
  25. package/src/layer/marker/Marker.js +103 -24
  26. package/src/layer/tile/GridLayer.js +22 -6
  27. package/src/layer/vector/Renderer.js +102 -11
  28. package/src/map/Map.js +408 -121
  29. package/src/map/handler/CompassBearing.js +33 -7
  30. package/src/map/handler/ContainerMutation.js +20 -3
  31. package/src/map/handler/ShiftKeyRotate.js +156 -16
  32. package/src/map/handler/TouchGestures.js +91 -29
  33. package/src/map/handler/TouchRotate.js +20 -3
  34. package/src/map/handler/TouchZoom.js +25 -5
  35. package/test/features/example.feature +5 -0
  36. package/test/features/rotation.feature +30 -0
  37. package/test/index.html +60 -22
  38. package/test/steps/bearing.steps.js +345 -3
  39. package/test/steps/example.steps.js +72 -11
  40. package/test/steps/gestures.steps.js +4 -4
  41. package/test/steps/overlays.steps.js +32 -32
  42. package/test/support/hooks.js +38 -2
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
 
@@ -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
- var rhoInput = document.getElementById('rho_input');
191
- var padInput = document.getElementById('pad_input');
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
- 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
+ }
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: function(e) {
258
+ logEvent(e) {
240
259
  console.log(e, e.type);
241
260
  },
242
261
 
243
- logMouse: function(e) {
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: function(e) {
274
+ rotate(e) {
256
275
  return (e.type !== 'mousemove' || e.buttons !== 0) && this._map.setBearing(e.target.valueAsNumber);
257
276
  },
258
277
 
259
- updatePaneBounds: function() {
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: function() {
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: function() {
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: function() {
295
- var panePos = this._getMapPanePos();
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: function() {
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: function() {
311
- var angle = document.getElementById('rho_input').valueAsNumber++;
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: function(map) {
319
- var markers = [],
337
+ randomRotateMarkers(map) {
338
+ const markers = [],
320
339
  steps = [];
321
340
 
322
- for (var i in map._layers) {
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 (var i = 0; i < markers.length; i++) {
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: function(map, number) {
343
- var map = this._map;
344
- var populate = function() {
361
+ randomMarkers(map, number) {
362
+ map = this._map;
363
+ const populate = function() {
345
364
  // populate map with a cluster of random markers
346
- for (var i = 0; i < number; i++) {
347
- var bounds = map.getBounds();
348
- var southWest = bounds.getSouthWest();
349
- var northEast = bounds.getNorthEast();
350
- var lngSpan = northEast.lng - southWest.lng;
351
- var latSpan = northEast.lat - southWest.lat;
352
- 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()));
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: function() {
385
- var map = this._map;
403
+ displayCenter() {
404
+ const map = this._map;
386
405
  if (this.___centerMarker) {
387
406
  this.___centerMarker.remove();
388
407
  }
389
- this.___centerMarker = L.circleMarker(map.getCenter(), {
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: function() {
400
- var map = this._map;
418
+ displayBounds() {
419
+ const map = this._map;
401
420
  if (this.___bounds) {
402
421
  this.___bounds.remove();
403
422
  }
404
423
 
405
- var padding = document.getElementById('pad_input').valueAsNumber;
406
- var latLngBounds = map.getBounds().pad(padding)
407
- 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, {
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: function() {
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
- let layer = globalThis[flytopath];
428
- let layerBounds = layer.getBounds();
429
- this[`___${flytopath}bounds`] = L.featureGroup([
430
- 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, {
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.marker(layerBounds.getNorthWest(), { scale: 0.5, rotation: -45 * L.DomUtil.DEG_TO_RAD, rotateWithView: true }).bindTooltip('<b>NW</b>', {direction: 'center'}),
439
- L.marker(layerBounds.getNorthEast(), { scale: 0.5, rotation: 45 * L.DomUtil.DEG_TO_RAD, rotateWithView: true }).bindTooltip('<b>NE</b>', {direction: 'center'}),
440
- L.marker(layerBounds.getSouthEast(), { scale: 0.5, rotation: 135 * L.DomUtil.DEG_TO_RAD, rotateWithView: true }).bindTooltip('<b>SE</b>', {direction: 'center'}),
441
- 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'}),
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: function() {
450
- var map = this._map;
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.point(0, 0);
458
- const TR = L.point(size.x, 0);
459
- const BR = L.point(size.x, size.y);
460
- const BL = L.point(0, size.y);
461
-
462
- const topLeft = L.marker( map.containerPointToLatLng(TL), { title: 'Top Left corner', rotation: -45 * L.DomUtil.DEG_TO_RAD } );
463
- const topRight = L.marker( map.containerPointToLatLng(TR), { title: 'Top Right corner', rotation: 45 * L.DomUtil.DEG_TO_RAD } );
464
- const bottomRight = L.marker( map.containerPointToLatLng(BR), { title: 'Bottom Right corner', rotation: 135 * L.DomUtil.DEG_TO_RAD } );
465
- const bottomLeft = L.marker( map.containerPointToLatLng(BL), { title: 'Bottom Left corner', rotation: -135 * L.DomUtil.DEG_TO_RAD } );
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.point(L.Marker.prototype.options.icon.options.iconAnchor || [0, 0]),
508
- // paddingBR = L.point(L.Marker.prototype.options.icon.options.iconSize || [0, 0]).subtract(paddingTL),
509
- // 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()) ]),
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: function(e) {
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: function() {
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 &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=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 &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})}}})();
@@ -1,3 +1,10 @@
1
+ /*
2
+ * For Leaflet.heat (https://github.com/Leaflet/Leaflet.heat) or the heatmap.js
3
+ * Leaflet plugin (https://github.com/pa7/heatmap.js/tree/master/plugins/leaflet-heatmap),
4
+ * load this file after the heatmap plugin. It adapts heat redraw coordinates to
5
+ * the rotated pane.
6
+ */
7
+
1
8
  if (!L.HeatLayer && !globalThis.HeatmapOverlay) {
2
9
  throw new Error('Load Leaflet.heat or heatmap.js Leaflet plugin before this adapter.');
3
10
  }
@@ -9,7 +16,7 @@ if (L.HeatLayer) {
9
16
  const heatLayerAnimateZoom = L.HeatLayer.prototype._animateZoom;
10
17
 
11
18
  L.HeatLayer.include({
12
- onAdd: function(map) {
19
+ onAdd(map) {
13
20
  heatLayerOnAdd.apply(this, arguments);
14
21
  if (map._rotate) {
15
22
  map.getPane('norotatePane').appendChild(this._canvas);
@@ -18,7 +25,7 @@ if (L.HeatLayer) {
18
25
  }
19
26
  },
20
27
 
21
- onRemove: function(map) {
28
+ onRemove(map) {
22
29
  if (map._rotate) {
23
30
  map.off('rotate', this._reset, this);
24
31
  map.getPane('overlayPane').appendChild(this._canvas);
@@ -26,7 +33,7 @@ if (L.HeatLayer) {
26
33
  return heatLayerOnRemove.apply(this, arguments);
27
34
  },
28
35
 
29
- _reset: function() {
36
+ _reset() {
30
37
  if (!this._map._rotate) {
31
38
  return heatLayerReset.apply(this, arguments);
32
39
  }
@@ -44,7 +51,7 @@ if (L.HeatLayer) {
44
51
  this._redraw();
45
52
  },
46
53
 
47
- _animateZoom: function(event) {
54
+ _animateZoom(event) {
48
55
  if (!this._map._rotate) {
49
56
  return heatLayerAnimateZoom.apply(this, arguments);
50
57
  }
@@ -66,7 +73,7 @@ if (globalThis.HeatmapOverlay) {
66
73
  const heatmapDraw = globalThis.HeatmapOverlay.prototype._draw;
67
74
 
68
75
  globalThis.HeatmapOverlay.include({
69
- onAdd: function(map) {
76
+ onAdd(map) {
70
77
  heatmapOnAdd.apply(this, arguments);
71
78
  if (map._rotate) {
72
79
  map.getPane('norotatePane').appendChild(this._el);
@@ -75,7 +82,7 @@ if (globalThis.HeatmapOverlay) {
75
82
  }
76
83
  },
77
84
 
78
- onRemove: function(map) {
85
+ onRemove(map) {
79
86
  if (map._rotate) {
80
87
  map.off('rotate', this._draw, this);
81
88
  map.getPane('overlayPane').appendChild(this._el);
@@ -83,7 +90,7 @@ if (globalThis.HeatmapOverlay) {
83
90
  return heatmapOnRemove.apply(this, arguments);
84
91
  },
85
92
 
86
- _draw: function() {
93
+ _draw() {
87
94
  const map = this._map;
88
95
  if (!map._rotate) {
89
96
  return heatmapDraw.apply(this, arguments);
@@ -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],