comparison client/src/fairway/store.js @ 1044:f8a4ec146d47

fixed Vue reactivity issue (splitscreen button)
author Markus Kottlaender <markus@intevation.de>
date Thu, 25 Oct 2018 10:22:30 +0200
parents e8ebfbc2aa05
children 28eb62f7c676
comparison
equal deleted inserted replaced
1043:740679d6682f 1044:f8a4ec146d47
9 * – Österreichische Wasserstraßen-Gesellschaft mbH 9 * – Österreichische Wasserstraßen-Gesellschaft mbH
10 * Software engineering by Intevation GmbH 10 * Software engineering by Intevation GmbH
11 * 11 *
12 * Author(s): 12 * Author(s):
13 * Thomas Junk <thomas.junk@intevation.de> 13 * Thomas Junk <thomas.junk@intevation.de>
14 * Markus Kottländer <markuks.kottlaender@intevation.de>
14 */ 15 */
16 import Vue from "vue";
15 import { HTTP } from "../application/lib/http"; 17 import { HTTP } from "../application/lib/http";
16 import { prepareProfile } from "../application/lib/geo"; 18 import { prepareProfile } from "../application/lib/geo";
17 import LineString from "ol/geom/LineString.js"; 19 import LineString from "ol/geom/LineString.js";
18 import { generateFeatureRequest } from "../application/lib/geo.js"; 20 import { generateFeatureRequest } from "../application/lib/geo.js";
19 21
56 if (!coordinates) return; 58 if (!coordinates) return;
57 const startPoint = state.startPoint; 59 const startPoint = state.startPoint;
58 const endPoint = state.endPoint; 60 const endPoint = state.endPoint;
59 const geoJSON = data; 61 const geoJSON = data;
60 const result = prepareProfile({ geoJSON, startPoint, endPoint }); 62 const result = prepareProfile({ geoJSON, startPoint, endPoint });
61 state.currentProfile[surveyDate] = result.points; 63 // Use Vue.set() to make new object properties rective
64 // https://vuejs.org/v2/guide/reactivity.html#Change-Detection-Caveats
65 Vue.set(state.currentProfile, surveyDate, result.points);
62 state.minAlt = result.minAlt; 66 state.minAlt = result.minAlt;
63 state.maxAlt = result.maxAlt; 67 state.maxAlt = result.maxAlt;
64 state.totalLength = result.lengthPolyLine; 68 state.totalLength = result.lengthPolyLine;
65 }, 69 },
66 setStartPoint: (state, start) => { 70 setStartPoint: (state, start) => {