summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
Diffstat (limited to 'platform/node')
-rw-r--r--platform/node/src/node_map.cpp13
-rw-r--r--platform/node/src/node_map.hpp1
-rw-r--r--platform/node/test/suite_implementation.js16
3 files changed, 22 insertions, 8 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 6deccf05bf..3791bb1b6d 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -548,7 +548,7 @@ void NodeMap::cancel() {
frontend = std::make_unique<mbgl::HeadlessFrontend>(mbgl::Size{ 256, 256 }, pixelRatio, *this, threadpool);
map = std::make_unique<mbgl::Map>(*frontend, mapObserver, frontend->getSize(), pixelRatio,
- *this, threadpool, mbgl::MapMode::Still);
+ *this, threadpool, mode);
// FIXME: Reload the style after recreating the map. We need to find
// a better way of canceling an ongoing rendering on the core level
@@ -1074,6 +1074,15 @@ NodeMap::NodeMap(v8::Local<v8::Object> options)
->NumberValue()
: 1.0;
}())
+ , mode([&] {
+ Nan::HandleScope scope;
+ if (Nan::Has(options, Nan::New("tile").ToLocalChecked()).FromJust() &&
+ Nan::Get(options, Nan::New("tile").ToLocalChecked()).ToLocalChecked()->BooleanValue()) {
+ return mbgl::MapMode::Tile;
+ } else {
+ return mbgl::MapMode::Static;
+ }
+ }())
, mapObserver(NodeMapObserver())
, frontend(std::make_unique<mbgl::HeadlessFrontend>(mbgl::Size { 256, 256 }, pixelRatio, *this, threadpool))
, map(std::make_unique<mbgl::Map>(*frontend,
@@ -1082,7 +1091,7 @@ NodeMap::NodeMap(v8::Local<v8::Object> options)
pixelRatio,
*this,
threadpool,
- mbgl::MapMode::Still)),
+ mode)),
async(new uv_async_t) {
async->data = this;
diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp
index 8e7f0a3e58..b84f4d576f 100644
--- a/platform/node/src/node_map.hpp
+++ b/platform/node/src/node_map.hpp
@@ -74,6 +74,7 @@ public:
std::unique_ptr<mbgl::AsyncRequest> request(const mbgl::Resource&, mbgl::FileSource::Callback);
const float pixelRatio;
+ mbgl::MapMode mode;
NodeThreadPool threadpool;
NodeMapObserver mapObserver;
std::unique_ptr<mbgl::HeadlessFrontend> frontend;
diff --git a/platform/node/test/suite_implementation.js b/platform/node/test/suite_implementation.js
index c5987538d0..05fb76f514 100644
--- a/platform/node/test/suite_implementation.js
+++ b/platform/node/test/suite_implementation.js
@@ -14,21 +14,25 @@ mbgl.on('message', function(msg) {
var maps = new Map();
module.exports = function (style, options, callback) {
+ var tileMode = options.mapMode === 'tile';
if (options.recycleMap) {
- if (maps.has(options.pixelRatio)) {
- var map = maps.get(options.pixelRatio);
+ var key = options.pixelRatio + '/' + tileMode;
+ if (maps.has(key)) {
+ var map = maps.get(key);
map.request = mapRequest;
} else {
- maps.set(options.pixelRatio, new mbgl.Map({
+ maps.set(key, new mbgl.Map({
ratio: options.pixelRatio,
- request: mapRequest
+ request: mapRequest,
+ tile: tileMode
}));
- var map = maps.get(options.pixelRatio);
+ var map = maps.get(key);
}
} else {
var map = new mbgl.Map({
ratio: options.pixelRatio,
- request: mapRequest
+ request: mapRequest,
+ tile: tileMode
});
}