summaryrefslogtreecommitdiff
path: root/platform/node
diff options
context:
space:
mode:
authorIvo van Dongen <info@ivovandongen.nl>2017-06-13 10:50:16 +0300
committerIvo van Dongen <ivovandongen@users.noreply.github.com>2017-07-18 10:45:12 +0200
commit39a732d7ae3cb1b927d94c4b1154b42d9565356a (patch)
tree5f33317467cb3dbdf19be3a8264818ff34f859eb /platform/node
parent57351c068b133ed140ac7b991181672019fe5c24 (diff)
downloadqtlocation-mapboxgl-39a732d7ae3cb1b927d94c4b1154b42d9565356a.tar.gz
[android][glfw][ios][macos][node][qt] split backend from mapobserver
Diffstat (limited to 'platform/node')
-rw-r--r--platform/node/src/node_map.cpp6
-rw-r--r--platform/node/src/node_map.hpp6
2 files changed, 9 insertions, 3 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp
index 9ba88193c9..78e98e2a28 100644
--- a/platform/node/src/node_map.cpp
+++ b/platform/node/src/node_map.cpp
@@ -45,7 +45,7 @@ static const char* releasedMessage() {
NodeBackend::NodeBackend()
: HeadlessBackend(sharedDisplay()) {}
-void NodeBackend::onDidFailLoadingMap(std::exception_ptr error) {
+void NodeMapObserver::onDidFailLoadingMap(std::exception_ptr error) {
std::rethrow_exception(error);
}
@@ -530,7 +530,7 @@ void NodeMap::Cancel(const Nan::FunctionCallbackInfo<v8::Value>& info) {
void NodeMap::cancel() {
auto style = map->getStyle().getJSON();
- map = std::make_unique<mbgl::Map>(backend, mbgl::Size{ 256, 256 },
+ map = std::make_unique<mbgl::Map>(backend, mapObserver, mbgl::Size{ 256, 256 },
pixelRatio, *this, threadpool, mbgl::MapMode::Still);
// FIXME: Reload the style after recreating the map. We need to find
@@ -982,7 +982,9 @@ NodeMap::NodeMap(v8::Local<v8::Object> options)
->NumberValue()
: 1.0;
}()),
+ mapObserver(NodeMapObserver()),
map(std::make_unique<mbgl::Map>(backend,
+ mapObserver,
mbgl::Size{ 256, 256 },
pixelRatio,
*this,
diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp
index 7b81ecd894..b8645e8d11 100644
--- a/platform/node/src/node_map.hpp
+++ b/platform/node/src/node_map.hpp
@@ -20,7 +20,10 @@ namespace node_mbgl {
class NodeBackend : public mbgl::HeadlessBackend {
public:
NodeBackend();
- void onDidFailLoadingMap(std::exception_ptr) final;
+};
+
+class NodeMapObserver : public mbgl::MapObserver {
+ void onDidFailLoadingMap(std::exception_ptr) override;
};
class NodeMap : public Nan::ObjectWrap,
@@ -71,6 +74,7 @@ public:
NodeBackend backend;
std::unique_ptr<mbgl::OffscreenView> view;
NodeThreadPool threadpool;
+ NodeMapObserver mapObserver;
std::unique_ptr<mbgl::Map> map;
std::exception_ptr error;