Fix zoom issue

This commit is contained in:
Willem Dantuma
2020-03-22 20:08:53 +01:00
parent af12682341
commit c777ce75ad
2 changed files with 42 additions and 28 deletions

View File

@@ -26,6 +26,10 @@ import {FeatureIconService} from '../services/feature-icon.service';
import * as style from 'ol/style';
import { ItemTypeService } from '@farmmaps/common';
import { Router } from '@angular/router';
@Injectable()
export class MapEffects {
@@ -252,7 +256,22 @@ export class MapEffects {
switchMap((action: mapActions.SetQueryState) => {
var newAction:Action;
if (action.queryState.itemCode && action.queryState.itemCode != "") {
newAction= new mapActions.SelectItem(action.queryState.itemCode);
let urlparts=[];
if(action.queryState.itemType && action.queryState.itemType!= "") {
let itemType = this.itemTypeService$.itemTypes[action.queryState.itemType];
if (itemType.viewer == "edit_in_editor" && itemType.editor) {
urlparts.push('/editor');
urlparts.push(itemType.editor);
urlparts.push('item');
urlparts.push(action.queryState.itemCode);
}
}
if(urlparts.length==0 ) {
newAction= new mapActions.SelectItem(action.queryState.itemCode);
} else {
this.router$.navigate(urlparts);
return [];
}
} else {
newAction= new mapActions.StartSearch(action.queryState);
}
@@ -272,7 +291,7 @@ export class MapEffects {
return of(newAction);
}));
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService) {
constructor(private actions$: Actions, private store$: Store<mapReducers.State>, private folderService$: FolderService, private itemService$: ItemService,private featureIconService$:FeatureIconService,private itemTypeService$:ItemTypeService,private router$:Router) {
this._geojsonFormat = new GeoJSON();
this._wktFormat = new WKT();
}