From 3530bb2468e683ec146f921b82db055350203629 Mon Sep 17 00:00:00 2001 From: Ansis Brammanis Date: Mon, 14 Mar 2016 19:11:59 -0700 Subject: [PATCH] fix querying after reloading vector tiles --- js/source/vector_tile_source.js | 1 + js/source/worker.js | 6 +++--- js/source/worker_tile.js | 2 +- test/js/source/worker_tile.test.js | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/js/source/vector_tile_source.js b/js/source/vector_tile_source.js index 5bf42a65e3a..28a43989e80 100644 --- a/js/source/vector_tile_source.js +++ b/js/source/vector_tile_source.js @@ -73,6 +73,7 @@ VectorTileSource.prototype = util.inherit(Evented, { }; if (tile.workerID) { + params.rawTileData = tile.rawTileData; this.dispatcher.send('reload tile', params, this._tileLoaded.bind(this, tile), tile.workerID); } else { tile.workerID = this.dispatcher.send('load tile', params, this._tileLoaded.bind(this, tile)); diff --git a/js/source/worker.js b/js/source/worker.js index 615b4927be7..0dee949f62b 100644 --- a/js/source/worker.js +++ b/js/source/worker.js @@ -83,7 +83,7 @@ util.extend(Worker.prototype, { if (err) return callback(err); tile.data = new vt.VectorTile(new Protobuf(new Uint8Array(data))); - tile.parse(tile.data, this.layers, this.actor, callback, data); + tile.parse(tile.data, this.layers, this.actor, data, callback); this.loaded[source] = this.loaded[source] || {}; this.loaded[source][uid] = tile; @@ -95,7 +95,7 @@ util.extend(Worker.prototype, { uid = params.uid; if (loaded && loaded[uid]) { var tile = loaded[uid]; - tile.parse(tile.data, this.layers, this.actor, callback); + tile.parse(tile.data, this.layers, this.actor, params.rawTileData, callback); } }, @@ -183,7 +183,7 @@ util.extend(Worker.prototype, { var geojsonWrapper = new GeoJSONWrapper(geoJSONTile.features); geojsonWrapper.name = '_geojsonTileLayer'; var rawTileData = vtpbf({ layers: { '_geojsonTileLayer': geojsonWrapper }}); - tile.parse(geojsonWrapper, this.layers, this.actor, callback, rawTileData); + tile.parse(geojsonWrapper, this.layers, this.actor, rawTileData, callback); this.loaded[source] = this.loaded[source] || {}; this.loaded[source][params.uid] = tile; diff --git a/js/source/worker_tile.js b/js/source/worker_tile.js index 5131ceb73c4..2e3ccd1767a 100644 --- a/js/source/worker_tile.js +++ b/js/source/worker_tile.js @@ -20,7 +20,7 @@ function WorkerTile(params) { this.collisionDebug = params.collisionDebug; } -WorkerTile.prototype.parse = function(data, layers, actor, callback, rawTileData) { +WorkerTile.prototype.parse = function(data, layers, actor, rawTileData, callback) { this.status = 'parsing'; this.data = data; diff --git a/test/js/source/worker_tile.test.js b/test/js/source/worker_tile.test.js index 6d8a1513a5f..315bc5a059c 100644 --- a/test/js/source/worker_tile.test.js +++ b/test/js/source/worker_tile.test.js @@ -24,7 +24,7 @@ test('basic', function(t) { coord: new TileCoord(1, 1, 1), overscaling: 1 }); t.test('basic worker tile', function(t) { - tile.parse(new Wrapper(features), buckets, {}, function(err, result) { + tile.parse(new Wrapper(features), buckets, {}, null, function(err, result) { t.equal(err, null); t.ok(result.buckets[0]); t.end();