From 66da5b5bb6cc0babc7b61a69d812fb904fff5b84 Mon Sep 17 00:00:00 2001 From: Gareth Dunstone Date: Tue, 4 Feb 2020 10:43:14 +1000 Subject: [PATCH 1/3] added toggle to disable dragging --- src/worldmap.ts | 9 +++++++++ src/worldmap_ctrl.ts | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/worldmap.ts b/src/worldmap.ts index 341f9a6..55f9ea0 100644 --- a/src/worldmap.ts +++ b/src/worldmap.ts @@ -45,6 +45,7 @@ export default class WorldMap { zoom: parseInt(this.ctrl.panel.initialZoom, 10) || 1, }); this.setMouseWheelZoom(); + this.setDragging(); const selectedTileServer = tileServers[this.ctrl.tileServer]; (window).L.tileLayer(selectedTileServer.url, { @@ -241,6 +242,14 @@ export default class WorldMap { } } + setDragging() { + if (!this.ctrl.panel.dragging) { + this.map.dragging.disable(); + } else { + this.map.dragging.enable(); + } + } + addCircles(circles) { return (window).L.layerGroup(circles).addTo(this.map); } diff --git a/src/worldmap_ctrl.ts b/src/worldmap_ctrl.ts index 4aa746c..ddce0b3 100644 --- a/src/worldmap_ctrl.ts +++ b/src/worldmap_ctrl.ts @@ -29,6 +29,7 @@ const panelDefaults = { unitPlural: "", showLegend: true, mouseWheelZoom: false, + dragging: false, esMetric: "Count", decimals: 0, hideEmpty: false, @@ -265,6 +266,11 @@ export default class WorldmapCtrl extends MetricsPanelCtrl { this.render(); } + toggleDragging() { + this.map.setDragging(); + this.render(); + } + toggleStickyLabels() { this.map.clearCircles(); this.render(); From 414be32d5bcd7ea5ac960876c87e2caa820e5b50 Mon Sep 17 00:00:00 2001 From: Gareth Dunstone Date: Tue, 4 Feb 2020 11:57:49 +1000 Subject: [PATCH 2/3] forgot the html to render the switch --- src/partials/editor.html | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/partials/editor.html b/src/partials/editor.html index 63c474e..c05b006 100644 --- a/src/partials/editor.html +++ b/src/partials/editor.html @@ -45,6 +45,8 @@
Map Visual Options
+ +
Map Data Options
From 91d834cae5146288e39f43bafb4cb804d49a57ef Mon Sep 17 00:00:00 2001 From: Gareth Dunstone Date: Tue, 4 Feb 2020 11:58:44 +1000 Subject: [PATCH 3/3] removed single whitespace --- src/partials/editor.html | 1 - 1 file changed, 1 deletion(-) diff --git a/src/partials/editor.html b/src/partials/editor.html index c05b006..6e118fe 100644 --- a/src/partials/editor.html +++ b/src/partials/editor.html @@ -45,7 +45,6 @@
Map Visual Options
-