Add custom style for vnd.farmmaps.itemntype.layer
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
All checks were successful
FarmMaps.Develop/FarmMapsLib/develop This commit looks good
This commit is contained in:
@@ -54,19 +54,27 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
return geometry;
|
||||
}
|
||||
|
||||
getSelectedStyle(feature:Feature):style.Style {
|
||||
let key = feature.get('itemType')+"_selected";
|
||||
if(this.stylesCache[key]) {
|
||||
return this.stylesCache[key];
|
||||
}
|
||||
return this.stylesCache["selected"];
|
||||
}
|
||||
|
||||
ngOnInit() {
|
||||
this.strategy = loadingstrategy.bbox;
|
||||
this.format = new GeoJSON();
|
||||
this._select = new Select({
|
||||
style: (feature) => {
|
||||
return this.stylesCache['selected'];
|
||||
return this.getSelectedStyle(feature);
|
||||
},
|
||||
hitTolerance: 10,
|
||||
layers: [this.layer.instance as Layer]
|
||||
});
|
||||
this._hoverSelect = new Select({
|
||||
style: (feature) => {
|
||||
return this.stylesCache['selected'];
|
||||
return this.getSelectedStyle(feature);
|
||||
},
|
||||
hitTolerance: 10,
|
||||
condition: (e: MapBrowserEvent) => {
|
||||
@@ -148,7 +156,7 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
||||
for (const key in styles) {
|
||||
if (styles.hasOwnProperty(key)) {
|
||||
let style = styles[key];
|
||||
if(style.geometry == null) {
|
||||
if(style.geometry_ == null) {
|
||||
style.setGeometry((feature) => this.geometry(feature));
|
||||
}
|
||||
this.stylesCache[key]=style;
|
||||
|
Reference in New Issue
Block a user