This commit is contained in:
parent
867fdc3fcc
commit
41d55110ea
@ -1,4 +1,4 @@
|
|||||||
import { Component, OnInit, OnDestroy, HostListener, Inject, ViewChild, AfterViewInit,ChangeDetectorRef } from '@angular/core';
|
import { Component, OnInit, OnDestroy, HostListener, Inject, ViewChild, AfterViewInit,ChangeDetectorRef,NgZone } from '@angular/core';
|
||||||
import { Location } from '@angular/common';
|
import { Location } from '@angular/common';
|
||||||
import { Observable, Subject, Subscription,combineLatest, from } from 'rxjs';
|
import { Observable, Subject, Subscription,combineLatest, from } from 'rxjs';
|
||||||
import { debounce, withLatestFrom, first, combineAll } from 'rxjs/operators';
|
import { debounce, withLatestFrom, first, combineAll } from 'rxjs/operators';
|
||||||
@ -81,7 +81,8 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
private serializeService: StateSerializerService,
|
private serializeService: StateSerializerService,
|
||||||
public itemTypeService: ItemTypeService,
|
public itemTypeService: ItemTypeService,
|
||||||
private location: Location,
|
private location: Location,
|
||||||
private geolocationService: GeolocationService) {
|
private geolocationService: GeolocationService,
|
||||||
|
private zone: NgZone) {
|
||||||
}
|
}
|
||||||
|
|
||||||
@HostListener('document:keyup', ['$event'])
|
@HostListener('document:keyup', ['$event'])
|
||||||
@ -248,26 +249,30 @@ export class MapComponent implements OnInit, OnDestroy,AfterViewInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
handleOnMoveEnd(event) {
|
handleOnMoveEnd(event) {
|
||||||
var map = event.map;
|
this.zone.run(() =>{
|
||||||
var view = map.getView();
|
var map = event.map;
|
||||||
var rotation = view.getRotation();
|
var view = map.getView();
|
||||||
var zoom = view.getZoom();
|
var rotation = view.getRotation();
|
||||||
var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
|
var zoom = view.getZoom();
|
||||||
var extent = view.calculateExtent(this.map.instance.getSize());
|
var center = transform(view.getCenter(), view.getProjection(), "EPSG:4326");
|
||||||
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
|
var extent = view.calculateExtent(this.map.instance.getSize());
|
||||||
let state = { mapState: mapState, extent: extent };
|
let mapState: IMapState = { xCenter: center[0], yCenter: center[1], zoom: zoom, rotation: rotation, baseLayerCode: null };
|
||||||
let source = from([state]);
|
let state = { mapState: mapState, extent: extent };
|
||||||
source.pipe(withLatestFrom(this.selectedBaseLayer$), withLatestFrom(this.queryState$)).subscribe(([[state, baselayer], queryState]) => {
|
let source = from([state]);
|
||||||
if (mapState && baselayer && queryState) {
|
source.pipe(withLatestFrom(this.selectedBaseLayer$), withLatestFrom(this.queryState$)).subscribe(([[state, baselayer], queryState]) => {
|
||||||
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
|
if (mapState && baselayer && queryState) {
|
||||||
this.replaceUrl(newMapState, tassign(queryState, { bbox: queryState.bboxFilter ? state.extent : queryState.bbox }));
|
let newMapState = tassign(state.mapState, { baseLayerCode: baselayer.item.code });
|
||||||
this.store.dispatch(new mapActions.SetViewExtent(state.extent));
|
this.replaceUrl(newMapState, tassign(queryState, { bbox: queryState.bboxFilter ? state.extent : queryState.bbox }));
|
||||||
}
|
this.store.dispatch(new mapActions.SetViewExtent(state.extent));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOnMouseDown(event: MouseEvent) {
|
handleOnMouseDown(event: MouseEvent) {
|
||||||
this.store.dispatch(new mapActions.CollapseSearch());
|
this.zone.run(() =>{
|
||||||
|
this.store.dispatch(new mapActions.CollapseSearch());
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleOnDownload(event) {
|
handleOnDownload(event) {
|
||||||
|
Loading…
Reference in New Issue
Block a user