Fix icon
All checks were successful
FarmMaps.Develop/FarmMapsLib/pipeline/head This commit looks good

This commit is contained in:
Willem Dantuma 2021-08-12 21:02:55 +02:00
parent 6ff3c0ec96
commit b52bfd4f57

View File

@ -112,17 +112,18 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
this.host.instance.setSource(this.instance); this.host.instance.setSource(this.instance);
this.host.instance.setStyle((feature) => { this.host.instance.setStyle((feature) => {
var key = feature.get('itemType') + (this.selectedItem?"_I":""); var itemType = feature.get('itemType');
var key = itemType + (this.selectedItem?"_I":"");
if (!this.stylesCache[key]) { if (!this.stylesCache[key]) {
if (this.itemTypeService.itemTypes[key]) { if (this.itemTypeService.itemTypes[itemType]) {
let itemType = this.itemTypeService.itemTypes[key]; let itemTypeEntry = this.itemTypeService.itemTypes[itemType];
let fillColor = color.asArray(itemType.iconColor); let fillColor = color.asArray(itemType.iconColor);
fillColor[3] = 0; fillColor[3] = 0;
this.stylesCache[key] = new style.Style({ this.stylesCache[key] = new style.Style({
image: itemType.icon ? new style.Icon({ image: itemTypeEntry.icon ? new style.Icon({
anchor: [0.5, 1], anchor: [0.5, 1],
scale: 0.05, scale: 0.05,
src: this.featureIconService$.getIconImageDataUrl(itemType.icon) src: this.featureIconService$.getIconImageDataUrl(itemTypeEntry.icon)
}):null, }):null,
stroke: new style.Stroke({ stroke: new style.Stroke({
color: 'red', color: 'red',