Fix unnecessary "hops" after zooming
FarmMaps.Develop/FarmMapsLib/develop This commit looks good Details

feature/MinimizeSolution
Willem Dantuma 2020-03-26 15:55:21 +01:00
parent dad8e061ea
commit 050fda377b
1 changed files with 2 additions and 5 deletions

View File

@ -178,7 +178,6 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
let rotation = parseFloat(params.get("rotation"));
let baseLayer = params.get("baseLayer")?params.get("baseLayer"):"";
newMapState = { xCenter: xCenter, yCenter: yCenter, zoom: zoom, rotation: rotation, baseLayerCode: baseLayer }
mapStateChanged = (JSON.stringify(lastMapState) != JSON.stringify(newMapState));
window.localStorage.setItem("FarmMapsCommonMap_mapState",JSON.stringify(newMapState));
}
if (params.has("queryState")) {
@ -194,13 +193,11 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
if(setStateCount==0) t=600;
setTimeout(() => {
this.zone.run(()=> {
if ( (queryStateChanged && mapStateChanged) || setStateCount ==0) {
if (setStateCount ==0) {
this.store.dispatch(new mapActions.SetState(newMapState,newQueryState));
} else if(queryStateChanged) {
this.store.dispatch(new mapActions.SetQueryState(newQueryState));
} else if (mapStateChanged) {
this.store.dispatch(new mapActions.SetMapState(newMapState));
}
}
})
},t);
});