diff --git a/src/ol/style.js b/src/ol/style.js index 744ffc2474..b9bc21cd64 100644 --- a/src/ol/style.js +++ b/src/ol/style.js @@ -1,12 +1,12 @@ /** * @module ol/style */ -import _ol_style_IconImageCache_ from './style/IconImageCache.js'; +import IconImageCache from './style/IconImageCache.js'; var _ol_style_ = {}; /** * The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images. * @api */ -_ol_style_.iconImageCache = new _ol_style_IconImageCache_(); +_ol_style_.iconImageCache = new IconImageCache(); export default _ol_style_; diff --git a/src/ol/style/IconImageCache.js b/src/ol/style/IconImageCache.js index 14935640f4..c7c773664a 100644 --- a/src/ol/style/IconImageCache.js +++ b/src/ol/style/IconImageCache.js @@ -7,7 +7,7 @@ import _ol_color_ from '../color.js'; * Singleton class. Available through {@link ol.style.iconImageCache}. * @constructor */ -var _ol_style_IconImageCache_ = function() { +var IconImageCache = function() { /** * @type {Object.} @@ -35,16 +35,16 @@ var _ol_style_IconImageCache_ = function() { * @param {ol.Color} color Color. * @return {string} Cache key. */ -_ol_style_IconImageCache_.getKey = function(src, crossOrigin, color) { +function getKey(src, crossOrigin, color) { var colorString = color ? _ol_color_.asString(color) : 'null'; return crossOrigin + ':' + src + ':' + colorString; -}; +} /** * FIXME empty description for jsdoc */ -_ol_style_IconImageCache_.prototype.clear = function() { +IconImageCache.prototype.clear = function() { this.cache_ = {}; this.cacheSize_ = 0; }; @@ -53,7 +53,7 @@ _ol_style_IconImageCache_.prototype.clear = function() { /** * FIXME empty description for jsdoc */ -_ol_style_IconImageCache_.prototype.expire = function() { +IconImageCache.prototype.expire = function() { if (this.cacheSize_ > this.maxCacheSize_) { var i = 0; var key, iconImage; @@ -74,8 +74,8 @@ _ol_style_IconImageCache_.prototype.expire = function() { * @param {ol.Color} color Color. * @return {ol.style.IconImage} Icon image. */ -_ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) { - var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color); +IconImageCache.prototype.get = function(src, crossOrigin, color) { + var key = getKey(src, crossOrigin, color); return key in this.cache_ ? this.cache_[key] : null; }; @@ -86,8 +86,8 @@ _ol_style_IconImageCache_.prototype.get = function(src, crossOrigin, color) { * @param {ol.Color} color Color. * @param {ol.style.IconImage} iconImage Icon image. */ -_ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, iconImage) { - var key = _ol_style_IconImageCache_.getKey(src, crossOrigin, color); +IconImageCache.prototype.set = function(src, crossOrigin, color, iconImage) { + var key = getKey(src, crossOrigin, color); this.cache_[key] = iconImage; ++this.cacheSize_; }; @@ -100,8 +100,8 @@ _ol_style_IconImageCache_.prototype.set = function(src, crossOrigin, color, icon * @param {number} maxCacheSize Cache max size. * @api */ -_ol_style_IconImageCache_.prototype.setSize = function(maxCacheSize) { +IconImageCache.prototype.setSize = function(maxCacheSize) { this.maxCacheSize_ = maxCacheSize; this.expire(); }; -export default _ol_style_IconImageCache_; +export default IconImageCache;