Merge pull request #11137 from osechet/types-2.0

Fix Openlayers StyleFunction returned type
This commit is contained in:
Zhengbo Li
2016-09-09 10:41:42 -07:00
committed by GitHub
3 changed files with 12 additions and 2 deletions
+1 -1
View File
@@ -4495,7 +4495,7 @@ declare namespace ol {
/**
* A function that takes an ol.Feature and a {number} representing the view's resolution. The function should return an array of ol.style.Style. This way e.g. a vector layer can be styled.
*/
interface StyleFunction { (feature: ol.Feature, resolution: number): ol.style.Style }
interface StyleFunction { (feature: ol.Feature, resolution: number): ol.style.Style | ol.style.Style[] }
}
namespace tilegrid {
+10
View File
@@ -685,6 +685,16 @@ draw = new ol.interaction.Draw({
type: "Point",
style: styleFunction
});
var styleFunctionAsStyle = function(feature: ol.Feature, resolution: number): ol.style.Style { return style; }
draw = new ol.interaction.Draw({
type: "Point",
style: styleFunctionAsStyle
});
var styleFunctionAsArray = function(feature: ol.Feature, resolution: number): ol.style.Style[] { return styleArray; }
draw = new ol.interaction.Draw({
type: "Point",
style: styleFunctionAsArray
});
var dragbox: ol.interaction.DragBox = new ol.interaction.DragBox({
className: stringValue,
+1 -1
View File
@@ -4651,7 +4651,7 @@ declare namespace ol {
/**
* A function that takes an ol.Feature and a {number} representing the view's resolution. The function should return an array of ol.style.Style. This way e.g. a vector layer can be styled.
*/
interface StyleFunction { (feature: ol.Feature, resolution: number): ol.style.Style }
interface StyleFunction { (feature: ol.Feature, resolution: number): ol.style.Style | ol.style.Style[] }
}
namespace tilegrid {