Take space into account when checking size
This commit is contained in:
@@ -100,7 +100,8 @@ ol.renderer.webgl.AtlasManager.prototype.getInfo = function(id) {
|
|||||||
*/
|
*/
|
||||||
ol.renderer.webgl.AtlasManager.prototype.add =
|
ol.renderer.webgl.AtlasManager.prototype.add =
|
||||||
function(id, width, height, renderCallback, opt_this) {
|
function(id, width, height, renderCallback, opt_this) {
|
||||||
if (width > this.maxSize_ || height > this.maxSize_) {
|
if (width + this.space_ > this.maxSize_ ||
|
||||||
|
height + this.space_ > this.maxSize_) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -228,7 +228,7 @@ describe('ol.renderer.webgl.AtlasManager', function() {
|
|||||||
it('returns null if the size exceeds the maximum size', function() {
|
it('returns null if the size exceeds the maximum size', function() {
|
||||||
var manager = new ol.renderer.webgl.AtlasManager(128);
|
var manager = new ol.renderer.webgl.AtlasManager(128);
|
||||||
expect(manager.add('1', 100, 100, defaultRender)).to.be.ok();
|
expect(manager.add('1', 100, 100, defaultRender)).to.be.ok();
|
||||||
expect(manager.add('2', 3000, 3000, defaultRender)).to.eql(null);
|
expect(manager.add('2', 2048, 2048, defaultRender)).to.eql(null);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user