summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
authorSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-07 14:29:19 +0200
committerSudarsana Babu Nagineni <sudarsana.babu@mapbox.com>2019-03-08 18:20:55 +0200
commit5e2b6bf636472a4464e6ab3ae0d9d01c68de041b (patch)
treed4a924f2ac4174a034448388fb65b033b801a83d /platform/node
parentc4115f0539be1834db40b318eb4ebb9e27d1eafb (diff)
downloadqtlocation-mapboxgl-5e2b6bf636472a4464e6ab3ae0d9d01c68de041b.tar.gz
[core] Add MapOptions to define properties of Map
To simplify the Map constructor, introduce MapOptions interface to define the properties that can be set on a Map.
Diffstat (limited to 'platform/node')
-rw-r--r--platform/node/src/node_map.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 533399a47c..b12d3552a4 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -616,11 +616,13 @@ void NodeMap::cancel() {
});
frontend = std::make_unique<mbgl::HeadlessFrontend>(mbgl::Size{ 256, 256 }, pixelRatio, *this, threadpool);
+ mbgl::MapOptions options;
+ options.withMapMode(mode)
+ .withConstrainMode(mbgl::ConstrainMode::HeightOnly)
+ .withViewportMode(mbgl::ViewportMode::Default)
+ .withCrossSourceCollisions(crossSourceCollisions);
map = std::make_unique<mbgl::Map>(*frontend, mapObserver, frontend->getSize(), pixelRatio,
- *this, threadpool, mode,
- mbgl::ConstrainMode::HeightOnly,
- mbgl::ViewportMode::Default,
- crossSourceCollisions);
+ *this, threadpool, options);
// FIXME: Reload the style after recreating the map. We need to find
// a better way of canceling an ongoing rendering on the core level
@@ -1205,10 +1207,10 @@ NodeMap::NodeMap(v8::Local<v8::Object> options)
pixelRatio,
*this,
threadpool,
- mode,
- mbgl::ConstrainMode::HeightOnly,
- mbgl::ViewportMode::Default,
- crossSourceCollisions)),
+ mbgl::MapOptions().withMapMode(mode)
+ .withConstrainMode(mbgl::ConstrainMode::HeightOnly)
+ .withViewportMode(mbgl::ViewportMode::Default)
+ .withCrossSourceCollisions(crossSourceCollisions))),
async(new uv_async_t) {
async->data = this;