From cabf1eefaf197e70f1a52e8c36e77642b06c163b Mon Sep 17 00:00:00 2001 From: Gareth Dunstone Date: Wed, 5 Feb 2020 11:20:20 +1000 Subject: [PATCH 1/3] added dragging toggle --- src/partials/editor.html | 3 ++- src/worldmap.ts | 9 +++++++++ src/worldmap_ctrl.ts | 6 ++++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/partials/editor.html b/src/partials/editor.html index ac9e524..508e0c5 100644 --- a/src/partials/editor.html +++ b/src/partials/editor.html @@ -361,7 +361,8 @@
Appearance
- + +
diff --git a/src/worldmap.ts b/src/worldmap.ts index 656979c..55fc18b 100644 --- a/src/worldmap.ts +++ b/src/worldmap.ts @@ -47,6 +47,7 @@ export default class WorldMap { attributionControl: this.ctrl.settings.showAttribution, }); this.setMouseWheelZoom(); + this.setDragging(); const selectedTileServer = tileServers[this.ctrl.tileServer]; (window as any).L.tileLayer(selectedTileServer.url, { @@ -445,6 +446,14 @@ export default class WorldMap { } } + setDragging() { + if (!this.ctrl.settings.dragging) { + this.map.dragging.disable(); + } else { + this.map.dragging.enable(); + } + } + addCircles(circles) { // Todo: Optionally add fixed custom attributions to the circle layer. const attribution = undefined; diff --git a/src/worldmap_ctrl.ts b/src/worldmap_ctrl.ts index 695b1a8..eec27a3 100644 --- a/src/worldmap_ctrl.ts +++ b/src/worldmap_ctrl.ts @@ -40,6 +40,7 @@ const panelDefaults = { customAttribution: false, customAttributionText: null, mouseWheelZoom: false, + dragging: true, esGeoPoint: null, // Todo: Investigate: Is "Count" a reasonable default here // or does it confuse the operator? @@ -504,6 +505,11 @@ export default class WorldmapCtrl extends MetricsPanelCtrl { this.render(); } + toggleDragging() { + this.map.setDragging(); + this.render(); + } + toggleCustomAttribution() { if (this.settings.customAttribution) { const attributionControl = this.map.map.attributionControl; From 798c81496b6a09bba0f598f5056eb15d94b3588e Mon Sep 17 00:00:00 2001 From: Gareth Dunstone Date: Wed, 5 Feb 2020 12:10:22 +1000 Subject: [PATCH 2/3] added option to disable double click zoom as well --- src/partials/editor.html | 2 ++ src/worldmap.ts | 8 ++++++++ src/worldmap_ctrl.ts | 6 ++++++ 3 files changed, 16 insertions(+) diff --git a/src/partials/editor.html b/src/partials/editor.html index 508e0c5..8cb9424 100644 --- a/src/partials/editor.html +++ b/src/partials/editor.html @@ -363,6 +363,8 @@
Appearance
+ +
diff --git a/src/worldmap.ts b/src/worldmap.ts index 55fc18b..b8c8926 100644 --- a/src/worldmap.ts +++ b/src/worldmap.ts @@ -454,6 +454,14 @@ export default class WorldMap { } } + setDoubleClickZoom() { + if (!this.ctrl.settings.doubleClickZoom) { + this.map.doubleClickZoom.disable(); + } else { + this.map.doubleClickZoom.enable(); + } + } + addCircles(circles) { // Todo: Optionally add fixed custom attributions to the circle layer. const attribution = undefined; diff --git a/src/worldmap_ctrl.ts b/src/worldmap_ctrl.ts index eec27a3..ad711fe 100644 --- a/src/worldmap_ctrl.ts +++ b/src/worldmap_ctrl.ts @@ -41,6 +41,7 @@ const panelDefaults = { customAttributionText: null, mouseWheelZoom: false, dragging: true, + doubleClickZoom: true, esGeoPoint: null, // Todo: Investigate: Is "Count" a reasonable default here // or does it confuse the operator? @@ -510,6 +511,11 @@ export default class WorldmapCtrl extends MetricsPanelCtrl { this.render(); } + toggleDoubleClickZoom() { + this.map.setDoubleClickZoom(); + this.render(); + } + toggleCustomAttribution() { if (this.settings.customAttribution) { const attributionControl = this.map.map.attributionControl; From fbef7cae1ee7c32d2cd19bd9ff702063a8d3dbe6 Mon Sep 17 00:00:00 2001 From: Gareth Dunstone Date: Wed, 5 Feb 2020 12:14:28 +1000 Subject: [PATCH 3/3] forgot to call setter on init --- src/worldmap.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/worldmap.ts b/src/worldmap.ts index b8c8926..c81fc77 100644 --- a/src/worldmap.ts +++ b/src/worldmap.ts @@ -48,6 +48,7 @@ export default class WorldMap { }); this.setMouseWheelZoom(); this.setDragging(); + this.setDoubleClickZoom(); const selectedTileServer = tileServers[this.ctrl.tileServer]; (window as any).L.tileLayer(selectedTileServer.url, {