Rename method and make it appear in the API docs
This commit is contained in:
@@ -2,4 +2,8 @@ goog.provide('ol.style');
|
|||||||
|
|
||||||
goog.require('ol.style.IconImageCache');
|
goog.require('ol.style.IconImageCache');
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The {@link ol.style.IconImageCache} for {@link ol.style.Icon} images.
|
||||||
|
* @api
|
||||||
|
*/
|
||||||
ol.style.iconImageCache = new ol.style.IconImageCache();
|
ol.style.iconImageCache = new ol.style.IconImageCache();
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ goog.require('ol.color');
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Singleton class. Available through {@link ol.style.iconImageCache}.
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
ol.style.IconImageCache = function() {
|
ol.style.IconImageCache = function() {
|
||||||
@@ -93,10 +94,13 @@ ol.style.IconImageCache.prototype.set = function(src, crossOrigin, color, iconIm
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set cache max size.
|
* Set the cache size of the icon cache. Default is `32`. Change this value when
|
||||||
|
* your map uses more than 32 different icon images and you are not caching icon
|
||||||
|
* styles on the application level.
|
||||||
* @param {number} maxCacheSize Cache max size.
|
* @param {number} maxCacheSize Cache max size.
|
||||||
|
* @api
|
||||||
*/
|
*/
|
||||||
ol.style.IconImageCache.prototype.setMaxCacheSize = function(maxCacheSize) {
|
ol.style.IconImageCache.prototype.setSize = function(maxCacheSize) {
|
||||||
this.maxCacheSize_ = maxCacheSize;
|
this.maxCacheSize_ = maxCacheSize;
|
||||||
this.expire();
|
this.expire();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ describe('ol.style.IconImageCache', function() {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('#setMaxCacheSize', function() {
|
describe('#setSize', function() {
|
||||||
it('sets max cache size and expires cache', function() {
|
it('sets max cache size and expires cache', function() {
|
||||||
var cache = ol.style.iconImageCache;
|
var cache = ol.style.iconImageCache;
|
||||||
|
|
||||||
@@ -81,7 +81,7 @@ describe('ol.style.IconImageCache', function() {
|
|||||||
|
|
||||||
expect(cache.cacheSize_).to.eql(3);
|
expect(cache.cacheSize_).to.eql(3);
|
||||||
|
|
||||||
cache.setMaxCacheSize(2);
|
cache.setSize(2);
|
||||||
|
|
||||||
expect(cache.maxCacheSize_).to.eql(2);
|
expect(cache.maxCacheSize_).to.eql(2);
|
||||||
expect(cache.cacheSize_).to.eql(2);
|
expect(cache.cacheSize_).to.eql(2);
|
||||||
|
|||||||
Reference in New Issue
Block a user