Skip to content

Commit

Permalink
fix querying after reloading vector tiles
Browse files Browse the repository at this point in the history
  • Loading branch information
ansis committed Mar 15, 2016
1 parent 48f5993 commit 3530bb2
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions js/source/vector_tile_source.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions js/source/worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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);
}
},

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion js/source/worker_tile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion test/js/source/worker_tile.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3530bb2

Please sign in to comment.