Fix feature highlighting
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<div *ngIf="features;let features">
|
||||
<a href="#" (click)="handleBackClick($event)">Go back</a>
|
||||
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
||||
<div class="row m-0 pl-3 pr-3" *ngFor="let feature of features" [ngClass]="{'selected':isFeatureSelected(feature)}" (click)="handleFeatureClick(feature)" (mouseenter)="handleFeatureMouseEnter(feature)" (mouseleave)="handleFeatureMouseLeave(feature)">
|
||||
<fm-map-feature-list-feature-container [feature]="feature"></fm-map-feature-list-feature-container>
|
||||
</div>
|
||||
</div>
|
||||
|
@@ -10,6 +10,6 @@ fm-map-feature-list-feature-container {
|
||||
user-select: none;
|
||||
}
|
||||
|
||||
.row:hover {
|
||||
.row.selected {
|
||||
background-color: gray('100');
|
||||
}
|
||||
|
@@ -1,4 +1,4 @@
|
||||
import { Component, Input, Injectable,Directive } from '@angular/core';
|
||||
import { Component, Input, Injectable,Directive,SimpleChanges } from '@angular/core';
|
||||
import { Location } from '@angular/common';
|
||||
import { Feature } from 'ol';
|
||||
import { Store } from '@ngrx/store';
|
||||
@@ -16,6 +16,7 @@ import { IQueryState } from '@farmmaps/common';
|
||||
export abstract class AbstractFeatureListComponent {
|
||||
@Input() features: Array<Feature>;
|
||||
@Input() queryState: IQueryState;
|
||||
@Input() selectedFeature: Feature;
|
||||
constructor(public store: Store<mapReducers.State | commonReducers.State>, public itemTypeService: ItemTypeService, private location: Location) {
|
||||
}
|
||||
|
||||
@@ -37,6 +38,11 @@ export abstract class AbstractFeatureListComponent {
|
||||
event.preventDefault();
|
||||
this.location.back();
|
||||
}
|
||||
|
||||
isFeatureSelected(feature:Feature):boolean {
|
||||
if(!this.selectedFeature) return false;
|
||||
return feature.getId() == this.selectedFeature.getId();
|
||||
}
|
||||
}
|
||||
|
||||
@Injectable()
|
||||
|
Reference in New Issue
Block a user