[client] Add settings panel!

This commit is contained in:
Starbeamrainbowlabs 2019-01-18 21:25:30 +00:00
parent a21cb1c3eb
commit a0130a72c9
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
6 changed files with 51 additions and 3 deletions

View file

@ -38,3 +38,8 @@ main {
z-index: 50; z-index: 50;
} }
.sms-panel {
top: initial !important; bottom: 0;
z-index: 100 !important;
}

View file

@ -9,7 +9,7 @@ class LayerHeatmap {
constructor(in_map) { constructor(in_map) {
this.map = in_map; this.map = in_map;
this.layer = new HeatmapOverlay({ this.overlay_config = {
radius: Config.heatmap.blob_radius, radius: Config.heatmap.blob_radius,
maxOpacity: 0.8, maxOpacity: 0.8,
scaleRadius: true, scaleRadius: true,
@ -18,7 +18,8 @@ class LayerHeatmap {
latField: "latitude", latField: "latitude",
lngField: "longitude", lngField: "longitude",
valueField: "value" valueField: "value"
}); };
this.layer = new HeatmapOverlay(this.overlay_config);
this.map.addLayer(this.layer); this.map.addLayer(this.layer);
} }

View file

@ -9,9 +9,11 @@ import GetFromUrl from './Helpers/GetFromUrl.mjs';
import Config from './Config.mjs'; import Config from './Config.mjs';
import LayerDeviceMarkers from './LayerDeviceMarkers.mjs'; import LayerDeviceMarkers from './LayerDeviceMarkers.mjs';
import LayerHeatmap from './LayerHeatmap.mjs'; import LayerHeatmap from './LayerHeatmap.mjs';
import UI from './UI.mjs';
class Map { class Map {
constructor() { constructor() {
} }
setup() { setup() {
@ -43,6 +45,8 @@ class Map {
console.info("[map] Heatmap loaded successfully."); console.info("[map] Heatmap loaded successfully.");
}); });
this.ui = new UI(this);
} }
async setup_device_markers() { async setup_device_markers() {

32
client_src/js/UI.mjs Normal file
View file

@ -0,0 +1,32 @@
"use strict";
import SmartSettings from 'smartsettings';
import Config from './Config.mjs';
class UI {
constructor(in_map_manager) {
this.map_manager = in_map_manager;
this.ui_panel = new SmartSettings("Settings");
this.ui_panel.loadConfig([
{
type: "range",
name: "Heatmap Blob Radius",
help: "The radius of blobs on the heatmap.",
items: [
0.001, // min
0.05, // max
Config.heatmap.blob_radius, // initial value
0.001 // step
],
callback: ((event) => {
this.map_manager.heatmap.overlay_config.radius = parseFloat(event.target.value);
}).bind(this)
}
]);
this.ui_panel.watch((event) => console.log(event));
}
}
export default UI;

5
package-lock.json generated
View file

@ -3482,6 +3482,11 @@
"integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==",
"dev": true "dev": true
}, },
"smartsettings": {
"version": "1.2.3",
"resolved": "https://registry.npmjs.org/smartsettings/-/smartsettings-1.2.3.tgz",
"integrity": "sha512-IPylE5IllnSAwKoA2To1otDrs40fdaQOnxCDXwjUCwnIHPr27Z+pjGpkbQqwhObb0poDnzldpbwa+5TYK107/g=="
},
"sort-keys": { "sort-keys": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz", "resolved": "https://registry.npmjs.org/sort-keys/-/sort-keys-1.1.2.tgz",

View file

@ -20,7 +20,8 @@
"leaflet": "^1.4.0", "leaflet": "^1.4.0",
"leaflet-fullscreen": "^1.0.2", "leaflet-fullscreen": "^1.0.2",
"leaflet-timedimension": "^1.1.0", "leaflet-timedimension": "^1.1.0",
"leaflet.markercluster": "^1.4.1" "leaflet.markercluster": "^1.4.1",
"smartsettings": "^1.2.3"
}, },
"devDependencies": { "devDependencies": {
"@types/leaflet": "^1.2.14", "@types/leaflet": "^1.2.14",