Try to fix exception
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2020-05-21 18:28:03 +02:00
parent d56cfa805b
commit 454dc26128

View File

@ -1,64 +1,64 @@
import { Component,Input,Output,EventEmitter } from '@angular/core'; import { Component,Input,Output,EventEmitter } from '@angular/core';
import { IItemLayer } from '../../../models/item.layer'; import { IItemLayer } from '../../../models/item.layer';
@Component({ @Component({
selector: 'fm-map-layer-list', selector: 'fm-map-layer-list',
templateUrl: './layer-list.component.html', templateUrl: './layer-list.component.html',
styleUrls: ['./layer-list.component.scss'] styleUrls: ['./layer-list.component.scss']
}) })
export class LayerListComponent { export class LayerListComponent {
@Input() itemLayers: IItemLayer[]; @Input() itemLayers: IItemLayer[] = [];
@Input() baseLayers: boolean = false; @Input() baseLayers: boolean = false;
@Output() onToggleVisibility = new EventEmitter<IItemLayer>(); @Output() onToggleVisibility = new EventEmitter<IItemLayer>();
@Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>(); @Output() onSetOpacity = new EventEmitter<{layer: IItemLayer,opacity:number }>();
@Output() onDelete = new EventEmitter<IItemLayer>(); @Output() onDelete = new EventEmitter<IItemLayer>();
@Output() onZoomToExtent = new EventEmitter<IItemLayer>(); @Output() onZoomToExtent = new EventEmitter<IItemLayer>();
@Output() onSelectLayer = new EventEmitter<IItemLayer>(); @Output() onSelectLayer = new EventEmitter<IItemLayer>();
@Input() selectedLayer: IItemLayer; @Input() selectedLayer: IItemLayer;
constructor( ) { constructor( ) {
} }
handleDelete(event:MouseEvent, item:IItemLayer) { handleDelete(event:MouseEvent, item:IItemLayer) {
this.onDelete.emit(item); this.onDelete.emit(item);
event.preventDefault(); event.preventDefault();
} }
handleToggleVisibility(event:MouseEvent, item: IItemLayer) { handleToggleVisibility(event:MouseEvent, item: IItemLayer) {
this.onToggleVisibility.emit(item); this.onToggleVisibility.emit(item);
item.legendVisible = item.visible && item.legendVisible; item.legendVisible = item.visible && item.legendVisible;
event.preventDefault(); event.preventDefault();
} }
handleSetOpacity(event: MouseEvent, layer: IItemLayer,opacity:number) { handleSetOpacity(event: MouseEvent, layer: IItemLayer,opacity:number) {
this.onSetOpacity.emit({ layer,opacity }); this.onSetOpacity.emit({ layer,opacity });
event.preventDefault(); event.preventDefault();
} }
handleZoomToExtent(event: MouseEvent, item: IItemLayer) { handleZoomToExtent(event: MouseEvent, item: IItemLayer) {
this.onZoomToExtent.emit(item); this.onZoomToExtent.emit(item);
event.preventDefault(); event.preventDefault();
} }
handleSelectLayer(event: MouseEvent, item: IItemLayer) { handleSelectLayer(event: MouseEvent, item: IItemLayer) {
this.onSelectLayer.emit(item); this.onSelectLayer.emit(item);
event.preventDefault(); event.preventDefault();
} }
firstLayer(item: IItemLayer): any { firstLayer(item: IItemLayer): any {
if (item && item.item && item.item.data && item.item.data.layers && item.item.data.layers.length > 0) return item.item.data.layers[0]; if (item && item.item && item.item.data && item.item.data.layers && item.item.data.layers.length > 0) return item.item.data.layers[0];
return null; return null;
} }
toggleLegend(event: MouseEvent, lg: boolean) { toggleLegend(event: MouseEvent, lg: boolean) {
event.preventDefault(); event.preventDefault();
return !lg; return !lg;
} }
handleLegendClick(event: MouseEvent, item: IItemLayer) { handleLegendClick(event: MouseEvent, item: IItemLayer) {
this.onSelectLayer.emit(item); this.onSelectLayer.emit(item);
this.onZoomToExtent.emit(item); this.onZoomToExtent.emit(item);
event.preventDefault(); event.preventDefault();
} }
} }