Use a Style or a Style function as parameter to setStyle action
This commit is contained in:
parent
4814b8fbad
commit
6060a8b86a
@ -207,7 +207,7 @@ export class DoQuery implements Action {
|
|||||||
export class SetStyle implements Action {
|
export class SetStyle implements Action {
|
||||||
readonly type = SETSTYLE;
|
readonly type = SETSTYLE;
|
||||||
|
|
||||||
constructor(public itemType:string,public style:Style) { }
|
constructor(public itemType:string,public style: Style | (Feature)) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Actions = SetMapState
|
export type Actions = SetMapState
|
||||||
|
@ -121,6 +121,9 @@ export class ItemVectorSourceComponent extends SourceVectorComponent implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var styleEntry = this.stylesCache[key];
|
var styleEntry = this.stylesCache[key];
|
||||||
|
if(typeof styleEntry === 'function') {
|
||||||
|
return styleEntry(feature);
|
||||||
|
}
|
||||||
return styleEntry;
|
return styleEntry;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import {Style} from 'ol';
|
import {Style,Feature} from 'ol';
|
||||||
|
|
||||||
export interface IStyles{
|
export interface IStyles{
|
||||||
[id: string]: Style;
|
[id: string]: Style | (Feature);
|
||||||
};
|
};
|
Loading…
Reference in New Issue
Block a user