Mercurial > gemma
comparison client/src/components/staging/StagingDetail.vue @ 1643:1fde2f48977b
fix: calculate center to zoom to via turfjs
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 20 Dec 2018 14:18:30 +0100 |
parents | f034371c5d11 |
children | 90211725e4a9 |
comparison
equal
deleted
inserted
replaced
1642:49c04bb64e0a | 1643:1fde2f48977b |
---|---|
147 import { STATES } from "@/store/imports.js"; | 147 import { STATES } from "@/store/imports.js"; |
148 import { HTTP } from "@/lib/http"; | 148 import { HTTP } from "@/lib/http"; |
149 import { WFS } from "ol/format.js"; | 149 import { WFS } from "ol/format.js"; |
150 import { or as orFilter, equalTo as equalToFilter } from "ol/format/filter.js"; | 150 import { or as orFilter, equalTo as equalToFilter } from "ol/format/filter.js"; |
151 import { displayError } from "@/lib/errors.js"; | 151 import { displayError } from "@/lib/errors.js"; |
152 import center from "@turf/center"; | |
152 | 153 |
153 export default { | 154 export default { |
154 name: "stagingdetail", | 155 name: "stagingdetail", |
155 props: ["data"], | 156 props: ["data"], |
156 data() { | 157 data() { |
232 }, | 233 }, |
233 isApproved(item) { | 234 isApproved(item) { |
234 return item.status === STATES.APPROVED; | 235 return item.status === STATES.APPROVED; |
235 }, | 236 }, |
236 moveToBottleneck(index) { | 237 moveToBottleneck(index) { |
237 const props = this.bottlenecks[index].properties; | 238 const { coordinates } = center(this.bottlenecks[index]).geometry; |
238 console.assert(props, "no props found!"); //inserted during bug hunt | |
239 const { bbox } = props; | |
240 console.assert(bbox, "no bbox found"); //inserted during bug hunt | |
241 const [lat1, long1, lat2, long2] = bbox; | |
242 const coordinates = [ | |
243 lat1 + (lat2 - lat1) / 2, | |
244 long1 + (long2 - long1) / 2 | |
245 ]; | |
246 this.moveMap(coordinates); | 239 this.moveMap(coordinates); |
247 }, | 240 }, |
248 moveMap(coordinates) { | 241 moveMap(coordinates) { |
249 this.$store.commit("map/moveMap", { | 242 this.$store.commit("map/moveMap", { |
250 coordinates: coordinates, | 243 coordinates: coordinates, |