From c1b097223bbee807552fc699f6d107a908134d04 Mon Sep 17 00:00:00 2001 From: Lucas Wojciechowski Date: Fri, 10 Mar 2017 15:21:42 -0800 Subject: [PATCH] WIP --- src/symbol/sprite_atlas.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/symbol/sprite_atlas.js b/src/symbol/sprite_atlas.js index 8e0b700b649..167556cd777 100644 --- a/src/symbol/sprite_atlas.js +++ b/src/symbol/sprite_atlas.js @@ -87,6 +87,21 @@ class SpriteAtlas extends Evented { this.fire('data', {dataType: 'style'}); } + removeImage(name) { + const image = this.images[name]; + + if (!image) { + this.fire('error', {error: new Error('No image with this name exists.')}); + } + + const rect = this.atlas.getBin(name); + + this.copy(new Uint32Array(image.width * image.height), image.width, rect, {pixelRatio: this.pixelRatio, x: 0, y: 0, width: image.width, height: image.height}, false); + this.atlas.deref(rect); + + this.fire('data', {dataType: 'style'}); + } + getImage(name, wrap) { if (this.images[name]) { return this.images[name];