Accept null styles

When a style is null, OpenLayers does not render the associated feature.
This commit is contained in:
Guillaume Beraudo
2018-08-20 09:46:52 +02:00
parent 4bd2de7b37
commit 589666cc2b
+7 -7
View File
@@ -1715,7 +1715,7 @@ export class Feature extends Object {
* representing the current style of this feature.
* @api stable
*/
getStyleFunction(): (ol.FeatureStyleFunction);
getStyleFunction(): (ol.FeatureStyleFunction | undefined);
/**
* Set the default geometry for the feature. This will update the property
@@ -6412,7 +6412,7 @@ export namespace layer {
* @return Layer style function.
* @api stable
*/
getStyleFunction(): (ol.StyleFunction);
getStyleFunction(): (ol.StyleFunction | undefined);
/**
* Set the style for features. This can be a single style object, an array
@@ -6424,7 +6424,7 @@ export namespace layer {
* @param style Layer style.
* @api stable
*/
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null)): void;
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void;
}
/**
@@ -8472,7 +8472,7 @@ export namespace source {
* @return Layer style function.
* @api stable
*/
getStyleFunction(): (ol.StyleFunction);
getStyleFunction(): (ol.StyleFunction | undefined);
/**
* Set the style for features. This can be a single style object, an array
@@ -8484,7 +8484,7 @@ export namespace source {
* @param style Layer style.
* @api stable
*/
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction)): void;
setStyle(style: (ol.style.Style | ol.style.Style[] | ol.StyleFunction | null | undefined)): void;
}
/**
@@ -10831,7 +10831,7 @@ export type FeatureLoader = (extent: ol.Extent, resolution: number, proj: ol.pro
* {@link ol.Feature} to be styled.
*
*/
export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[]);
export type FeatureStyleFunction = (resolution: number) => (ol.style.Style | ol.style.Style[] | null);
/**
* {@link ol.source.Vector} sources use a function of this type to get the url
@@ -10981,7 +10981,7 @@ export interface StyleImageOptions {
* or an array of them. This way e.g. a vector layer can be styled.
*
*/
export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[]);
export type StyleFunction = (feature: (ol.Feature | ol.render.Feature), resolution: number) => (ol.style.Style | ol.style.Style[] | null);
/**
* A function that takes an {@link ol.Feature} as argument and returns an