Take space into account when checking size

This commit is contained in:
tsauerwein
2014-11-06 17:09:34 +01:00
parent f0841b38cd
commit 64da2647a6
2 changed files with 3 additions and 2 deletions

View File

@@ -100,7 +100,8 @@ ol.renderer.webgl.AtlasManager.prototype.getInfo = function(id) {
*/
ol.renderer.webgl.AtlasManager.prototype.add =
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;
}

View File

@@ -228,7 +228,7 @@ describe('ol.renderer.webgl.AtlasManager', function() {
it('returns null if the size exceeds the maximum size', function() {
var manager = new ol.renderer.webgl.AtlasManager(128);
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);
});
});