# HG changeset patch # User Markus Kottlaender # Date 1555001860 -7200 # Node ID 2e2a271c1026f070492e71009a83bf247b03fcf7 # Parent 94edd5e5dd1b8c8388e8bb8347bcb2cc09bb2d69 client: fixed layer factory to actually serve different objects diff -r 94edd5e5dd1b -r 2e2a271c1026 client/src/components/map/Map.vue --- a/client/src/components/map/Map.vue Thu Apr 11 17:48:18 2019 +0200 +++ b/client/src/components/map/Map.vue Thu Apr 11 18:57:40 2019 +0200 @@ -69,6 +69,9 @@ ...mapState("bottlenecks", ["selectedSurvey"]), ...mapState("application", ["showSplitscreen", "panes", "paneMode"]), ...mapState("imports", ["selectedStretchId"]), + layers() { + return layers(); + }, hasActiveInteractions() { return ( (this.lineTool && this.lineTool.getActive()) || @@ -82,14 +85,14 @@ const exists = bottleneck_id != "does_not_exist"; if (exists) { - layers + this.layers .get("BOTTLENECKISOLINE") .getSource() .updateParams({ cql_filter: `date_info='${datestr}' AND bottleneck_id='${bottleneck_id}'` }); } - layers.get("BOTTLENECKISOLINE").setVisible(exists); + this.layers.get("BOTTLENECKISOLINE").setVisible(exists); } }, watch: { @@ -122,7 +125,7 @@ } }, selectedStretchId(id) { - layers + this.layers .get("STRETCHES") .getSource() .getFeatures() @@ -136,7 +139,7 @@ }, mounted() { this.map = new Map({ - layers: layers.config, + layers: this.layers.config, target: "map-" + this.uuid, controls: [], view: new View({ @@ -146,7 +149,7 @@ projection: "EPSG:3857" }) }); - this.map.getLayer = id => layers.get(id); + this.map.getLayer = id => this.layers.get(id); // store map position on every move // will be obsolete once we abandoned the separated admin context @@ -212,7 +215,7 @@ color: btlnFillC }) }); - layers.get("BOTTLENECKS").setStyle(newStyle); + this.layers.get("BOTTLENECKS").setStyle(newStyle); }) .catch(error => { console.log(error); diff -r 94edd5e5dd1b -r 2e2a271c1026 client/src/components/map/layers.js --- a/client/src/components/map/layers.js Thu Apr 11 17:48:18 2019 +0200 +++ b/client/src/components/map/layers.js Thu Apr 11 18:57:40 2019 +0200 @@ -56,7 +56,7 @@ }; }; -export default (function() { +export default function() { return { get(id) { return this.config.find(l => l.get("id") === id); @@ -491,4 +491,4 @@ }) ] }; -})(); +}