Another attemt to fix zooming
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good

This commit is contained in:
Willem Dantuma 2020-02-21 00:51:10 +01:00
parent 3a38c24360
commit c341b3e42f

View File

@ -130,7 +130,7 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.selectedFeatures$.next(null); this.selectedFeatures$.next(null);
this.query$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe((state) => { this.query$.pipe(withLatestFrom(this.mapState$),withLatestFrom(this.setStateCount$)).subscribe((state) => {
if(state[1]>0) this.replaceUrl(state[0][1], state[0][0],false); if(state[1]>0) this.replaceUrl(state[0][1], state[0][0],false);
}); });
} }
initCustomStyles() { initCustomStyles() {
@ -182,6 +182,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
} }
queryStateChanged = this.serializeService.serialize(lastQueryState) != queryState; queryStateChanged = this.serializeService.serialize(lastQueryState) != queryState;
} }
let t =0;
if(setStateCount==0) t=600;
setTimeout(() => { setTimeout(() => {
this.zone.run(()=> { this.zone.run(()=> {
if ( queryStateChanged && mapStateChanged) { if ( queryStateChanged && mapStateChanged) {
@ -195,12 +197,12 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
this.store.dispatch(new mapActions.SetMapState(newMapState)); this.store.dispatch(new mapActions.SetMapState(newMapState));
} }
}) })
},0); },t);
}); });
setTimeout(() => { setTimeout(() => {
this.map.instance.updateSize(); this.map.instance.updateSize();
}, 500); }, 500);
console.debug("Afterviewinit"); console.debug("Afterviewinit");
} }
handleSearchCollapse(event) { handleSearchCollapse(event) {