Remove static function from ImageTile

This commit is contained in:
Tim Schaub
2018-02-19 10:07:14 -07:00
parent fba4d82bdb
commit bca8938a02

View File

@@ -68,7 +68,7 @@ inherits(ImageTile, Tile);
ImageTile.prototype.disposeInternal = function() { ImageTile.prototype.disposeInternal = function() {
if (this.state == TileState.LOADING) { if (this.state == TileState.LOADING) {
this.unlistenImage_(); this.unlistenImage_();
this.image_ = ImageTile.getBlankImage(); this.image_ = getBlankImage();
} }
if (this.interimTile) { if (this.interimTile) {
this.interimTile.dispose(); this.interimTile.dispose();
@@ -105,7 +105,7 @@ ImageTile.prototype.getKey = function() {
ImageTile.prototype.handleImageError_ = function() { ImageTile.prototype.handleImageError_ = function() {
this.state = TileState.ERROR; this.state = TileState.ERROR;
this.unlistenImage_(); this.unlistenImage_();
this.image_ = ImageTile.getBlankImage(); this.image_ = getBlankImage();
this.changed(); this.changed();
}; };
@@ -167,10 +167,11 @@ ImageTile.prototype.unlistenImage_ = function() {
* Get a 1-pixel blank image. * Get a 1-pixel blank image.
* @return {HTMLCanvasElement} Blank image. * @return {HTMLCanvasElement} Blank image.
*/ */
ImageTile.getBlankImage = function() { function getBlankImage() {
const ctx = createCanvasContext2D(1, 1); const ctx = createCanvasContext2D(1, 1);
ctx.fillStyle = 'rgba(0,0,0,0)'; ctx.fillStyle = 'rgba(0,0,0,0)';
ctx.fillRect(0, 0, 1, 1); ctx.fillRect(0, 0, 1, 1);
return ctx.canvas; return ctx.canvas;
}; }
export default ImageTile; export default ImageTile;