Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
In still mode, don't load resources until a render request is made
Browse files Browse the repository at this point in the history
  • Loading branch information
jfirebaugh committed Sep 1, 2015
1 parent 0918ad5 commit 55d25a8
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
22 changes: 22 additions & 0 deletions platform/node/test/js/map.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,28 @@ test('Map', function(t) {
map.release();
t.end();
});

t.test('does not immediately trigger any tile loads', function(t) {
var map = new mbgl.Map({
request: function(req) {
if (req.url === './fixtures/tiles.tilejson') {
fs.readFile(path.join('test', req.url), function (err, data) {
req.respond(err, {data: data});
});
} else {
t.fail('unexpected request ' + req.url);
}
},
ratio: 1
});

map.load(style);

setTimeout(function() {
map.release();
t.end();
}, 100);
});
});

t.test('.render', function(t) {
Expand Down
2 changes: 1 addition & 1 deletion src/mbgl/map/map_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ void MapContext::update() {
updateFlags = Update::Nothing;
}

if (updateFlags == Update::Nothing) {
if (updateFlags == Update::Nothing || (data.mode == MapMode::Still && !callback)) {
return;
}

Expand Down

0 comments on commit 55d25a8

Please sign in to comment.