Mercurial > gemma
changeset 1633:f034371c5d11
refac: move to map in staging component resolves now via id
Currently we observe on some builds (not machines), that
the zoom to a specific bottleneck does not work occasionaly.
To exclude problems I restrucutred, how the information is resolved
and included several assert statements to help hunting down this
strange bug. The assert statemants could stay in the code anyways,
because the do not do any harm.
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Thu, 20 Dec 2018 09:37:29 +0100 |
parents | 0123a120e999 |
children | 05a2732cafac |
files | client/src/components/staging/StagingDetail.vue client/src/store/map.js |
diffstat | 2 files changed, 11 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/components/staging/StagingDetail.vue Thu Dec 20 08:42:06 2018 +0100 +++ b/client/src/components/staging/StagingDetail.vue Thu Dec 20 09:37:29 2018 +0100 @@ -85,16 +85,13 @@ v-for="(bottleneck, index) in bottlenecks" :key="index" class="d-flex flex-row" - v-if="show" + v-if="show && bottlenecks.length > 0" > <div class="d-flex flex-column"> <div class="d-flex flex-row"> - <a - @click="moveToBottleneck(bottleneck.properties.bbox)" - class="small" - href="#" - >{{ bottleneck.properties.objnam }}</a - > + <a @click="moveToBottleneck(index)" class="small" href="#">{{ + bottleneck.properties.objnam + }}</a> <div @click="showFull = !showFull" class="small mt-auto mb-auto text-info text-left" @@ -236,7 +233,11 @@ isApproved(item) { return item.status === STATES.APPROVED; }, - moveToBottleneck(bbox) { + 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,
--- a/client/src/store/map.js Thu Dec 20 08:42:06 2018 +0100 +++ b/client/src/store/map.js Thu Dec 20 09:37:29 2018 +0100 @@ -385,7 +385,9 @@ state.cutTool = cutTool; }, moveMap: (state, { coordinates, zoom, preventZoomOut }) => { + console.assert(state.openLayersMap, "no Map found"); // inserted during bug hunt let view = state.openLayersMap.getView(); + console.assert(view, "no view found"); // inserted during bug hunt const currentZoom = view.getZoom(); view.animate({ zoom: preventZoomOut ? Math.max(zoom, currentZoom) : zoom,