changeset 1048:bdc8b4160872

search results only zoom in, not out
author Markus Kottlaender <markus@intevation.de>
date Thu, 25 Oct 2018 11:06:13 +0200
parents 2cbc905ff0e9
children e3df77b8074f
files client/src/application/Topbar.vue
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/client/src/application/Topbar.vue	Thu Oct 25 10:58:37 2018 +0200
+++ b/client/src/application/Topbar.vue	Thu Oct 25 11:06:13 2018 +0200
@@ -212,9 +212,14 @@
       // DEBUG console.log("Moving to", resultEntry);
       if (resultEntry.geom.type == "Point") {
         let view = this.openLayersMap.getView();
+        const currentZoom = view.getZoom();
+        const newZoom =
+          resultEntry.type === "bottleneck"
+            ? Math.max(17, currentZoom)
+            : Math.max(15, currentZoom);
         view.animate(
           {
-            zoom: resultEntry.type === "bottleneck" ? 17 : 15,
+            zoom: newZoom,
             center: fromLonLat(
               resultEntry.geom.coordinates,
               view.getProjection()