From 89019ea23396eb237fdd75d5fe5d7fede78f8422 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 26 Aug 2014 17:09:43 +0200 Subject: [PATCH 1/2] Fix ol.style.defaultStyleFunction signature --- src/ol/style/style.js | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/ol/style/style.js b/src/ol/style/style.js index b182db47bb..c3d72ccbf9 100644 --- a/src/ol/style/style.js +++ b/src/ol/style/style.js @@ -171,11 +171,15 @@ ol.style.defaultStyleFunction = function(feature, resolution) { // now that we've run it the first time, // replace the function with a constant version - ol.style.defaultStyleFunction = - /** @type {function(this:ol.Feature):Array.} */( - function(resolution) { - return styles; - }); + + /** + * @param {ol.Feature} feature Feature. + * @param {number} resolution Resolution. + * @return {Array.} Style. + */ + ol.style.defaultStyleFunction = function(feature, resolution) { + return styles; + }; return styles; }; From 0d92d7abc1b4bb9029fbec8084b1ee5bb1a4cf1c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89ric=20Lemoine?= Date: Tue, 26 Aug 2014 17:10:07 +0200 Subject: [PATCH 2/2] Better comments in ol.style.defaultStyleFunction --- src/ol/style/style.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/ol/style/style.js b/src/ol/style/style.js index c3d72ccbf9..f108b801c3 100644 --- a/src/ol/style/style.js +++ b/src/ol/style/style.js @@ -169,8 +169,11 @@ ol.style.defaultStyleFunction = function(feature, resolution) { }) ]; - // now that we've run it the first time, - // replace the function with a constant version + // Now that we've run it the first time, replace the function with + // a constant version. We don't use an immediately-invoked function + // and a closure not to get an error at script evaluation time in + // browsers that do not support Canvas. ol.style.Circle indeed + // does canvas.getContext('2d') at construction time. /** * @param {ol.Feature} feature Feature.