From a9e1f332ff6fc376bde6ba87483cab706efb1068 Mon Sep 17 00:00:00 2001
From: Armand Bahi <armand.bahi@veremes.com>
Date: Tue, 13 Nov 2018 12:21:06 +0100
Subject: [PATCH] =?UTF-8?q?[zoom=20suivant=20precedent]=20Dysfonctionnemen?=
 =?UTF-8?q?t=20quand=20on=20ouvre=20les=20volets=20lat=C3=A9raux=20fix=20#?=
 =?UTF-8?q?23?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .../javascript/app/vmap/tools/location.js     | 19 ++++++++++++++++---
 1 file changed, 16 insertions(+), 3 deletions(-)

diff --git a/src/module_vmap/module/javascript/app/vmap/tools/location.js b/src/module_vmap/module/javascript/app/vmap/tools/location.js
index 4cd96440..415bd9cb 100644
--- a/src/module_vmap/module/javascript/app/vmap/tools/location.js
+++ b/src/module_vmap/module/javascript/app/vmap/tools/location.js
@@ -197,12 +197,25 @@ nsVmap.nsToolsManager.Location.prototype.locationController = function ($scope,
 
 	        fHistoryDelayHandler = $timeout(function () {
 	        	if(this_['iHistoryOffset'] === 0){
-	        		this_["aLocationHistory"].push({
+
+                    var oNewLocation = {
 		        		center: this_.map_.getView().getCenter(),
 		        		zoom: this_.map_.getView().getZoom()
-		    		});
+		    		}
+
+                    var oLastLocation = this_['aLocationHistory'][this_['aLocationHistory'].length - 1];
+
+                    if (this_['aLocationHistory'].length > 0) {
+                        if (oNewLocation.zoom === oLastLocation.zoom &&
+                            oNewLocation.center[0] === oLastLocation.center[0] &&
+                            oNewLocation.center[1] === oLastLocation.center[1]) {
+                            return 0;
+                        }
+                    }
+
+	        		this_["aLocationHistory"].push(oNewLocation);
 	        	} else {
-	        		// splice 
+	        		// splice
 	        		var iHistoryPosition = this_['aLocationHistory'].length - (this_['iHistoryOffset']);
 	        		this_["aLocationHistory"].splice(iHistoryPosition, this_['iHistoryOffset'], {
 		        		center: this_.map_.getView().getCenter(),
-- 
GitLab