From 2773f2ff4699bd53b4c3732c3be627087a375fc6 Mon Sep 17 00:00:00 2001 From: Anand Thakker Date: Tue, 7 Jun 2016 15:07:42 -0400 Subject: [PATCH] Fix extend/inherit and other minor errors --- js/source/geojson_source.js | 2 +- js/source/image_source.js | 5 ++++- js/source/tile_pyramid.js | 4 ++-- js/source/vector_tile_source.js | 2 +- js/source/video_source.js | 2 ++ 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/js/source/geojson_source.js b/js/source/geojson_source.js index 866ab092ae9..fcb9fc5610f 100644 --- a/js/source/geojson_source.js +++ b/js/source/geojson_source.js @@ -65,7 +65,7 @@ function GeoJSONSource(id, options, dispatcher) { }.bind(this)); } -GeoJSONSource.prototype = util.extend(Evented, /** @lends GeoJSONSource.prototype */ { +GeoJSONSource.prototype = util.inherit(Evented, /** @lends GeoJSONSource.prototype */ { minzoom: 0, maxzoom: 18, tileSize: 512, diff --git a/js/source/image_source.js b/js/source/image_source.js index ad8b0b856d4..1b95f0b8e6a 100644 --- a/js/source/image_source.js +++ b/js/source/image_source.js @@ -12,7 +12,9 @@ var RasterBoundsArray = require('../render/draw_raster').RasterBoundsArray; var Buffer = require('../data/buffer'); var VertexArrayObject = require('../render/vertex_array_object'); -module.exports = ImageSource; +module.exports.create = function (id, options, dispatcher) { + return new ImageSource(id, options, dispatcher); +}; /** * Create an Image source instance given an options object @@ -48,6 +50,7 @@ function ImageSource(options) { }.bind(this)); this._loaded = true; + this.fire('load'); if (this.map) { this.setCoordinates(options.coordinates); diff --git a/js/source/tile_pyramid.js b/js/source/tile_pyramid.js index 869bdb4e867..8febcc13004 100644 --- a/js/source/tile_pyramid.js +++ b/js/source/tile_pyramid.js @@ -48,7 +48,7 @@ function TilePyramid(id, options, dispatcher) { }.bind(this)); this._tiles = {}; - this._cache = new Cache(0, this.unload.bind(this)); + this._cache = new Cache(0, this.unloadTile.bind(this)); this._filterRendered = this._filterRendered.bind(this); } @@ -285,7 +285,7 @@ TilePyramid.prototype = util.inherit(Evented, { // better, retained tiles. They are not drawn separately. this._coveredTiles = {}; - var required = this.used ? transform.coveringTiles(this) : []; + var required = this.used ? transform.coveringTiles(this._source) : []; for (i = 0; i < required.length; i++) { coord = required[i]; tile = this.addTile(coord); diff --git a/js/source/vector_tile_source.js b/js/source/vector_tile_source.js index a32437a29fc..f06708c50da 100644 --- a/js/source/vector_tile_source.js +++ b/js/source/vector_tile_source.js @@ -29,7 +29,7 @@ function VectorTileSource(id, options, dispatcher) { }.bind(this)); } -VectorTileSource.prototype = util.extend(Evented, { +VectorTileSource.prototype = util.inherit(Evented, { minzoom: 0, maxzoom: 22, scheme: 'xyz', diff --git a/js/source/video_source.js b/js/source/video_source.js index edf83a3aaf6..23c9ad6363e 100644 --- a/js/source/video_source.js +++ b/js/source/video_source.js @@ -65,6 +65,8 @@ function VideoSource(id, options) { this.video.play(); this.setCoordinates(options.coordinates); } + + this.fire('load'); }.bind(this)); }