Mercurial > gemma
diff 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 |
line wrap: on
line diff
--- a/client/src/components/staging/StagingDetail.vue Thu Dec 20 13:45:32 2018 +0100 +++ b/client/src/components/staging/StagingDetail.vue Thu Dec 20 14:18:30 2018 +0100 @@ -149,6 +149,7 @@ import { WFS } from "ol/format.js"; import { or as orFilter, equalTo as equalToFilter } from "ol/format/filter.js"; import { displayError } from "@/lib/errors.js"; +import center from "@turf/center"; export default { name: "stagingdetail", @@ -234,15 +235,7 @@ return item.status === STATES.APPROVED; }, moveToBottleneck(index) { - const props = this.bottlenecks[index].properties; - console.assert(props, "no props found!"); //inserted during bug hunt - const { bbox } = props; - console.assert(bbox, "no bbox found"); //inserted during bug hunt - const [lat1, long1, lat2, long2] = bbox; - const coordinates = [ - lat1 + (lat2 - lat1) / 2, - long1 + (long2 - long1) / 2 - ]; + const { coordinates } = center(this.bottlenecks[index]).geometry; this.moveMap(coordinates); }, moveMap(coordinates) {