In still mode, don't load resources until a render request is made

This commit is contained in:
John Firebaugh
2015-08-31 17:56:27 -07:00
parent 0918ad5a29
commit 55d25a80a7
2 changed files with 23 additions and 1 deletions

View File

@@ -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) {

View File

@@ -259,7 +259,7 @@ void MapContext::update() {
updateFlags = Update::Nothing;
}
if (updateFlags == Update::Nothing) {
if (updateFlags == Update::Nothing || (data.mode == MapMode::Still && !callback)) {
return;
}