From 6867aa0394200fdbd366eaef5eae98b032d111c5 Mon Sep 17 00:00:00 2001 From: bsudekum Date: Mon, 2 Nov 2015 15:54:29 -0800 Subject: [PATCH] [node] add pitch option --- package.json | 2 +- platform/node/src/node_map.cpp | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a811ee7ee9..d555ffe555c 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,7 @@ ], "devDependencies": { "aws-sdk": "^2.2.9", - "mapbox-gl-test-suite": "git+https://github.com/mapbox/mapbox-gl-test-suite.git#4931d2b99894e1e02c0a1cc28becdb0546d356ed", + "mapbox-gl-test-suite": "git+https://github.com/mapbox/mapbox-gl-test-suite.git#bbf55fb517eb2d55ba34dd0dced80af425e6db0d", "request": "^2.65.0", "tape": "^4.2.1" }, diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index e36f9bc2224..c47eae3614f 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -17,6 +17,7 @@ namespace node_mbgl { struct NodeMap::RenderOptions { double zoom = 0; double bearing = 0; + double pitch = 0; double latitude = 0; double longitude = 0; unsigned int width = 512; @@ -204,6 +205,10 @@ std::unique_ptr NodeMap::ParseOptions(v8::Localbearing = Nan::Get(obj, Nan::New("bearing").ToLocalChecked()).ToLocalChecked()->NumberValue(); } + if (Nan::Has(obj, Nan::New("pitch").ToLocalChecked()).FromJust()) { + options->pitch = Nan::Get(obj, Nan::New("pitch").ToLocalChecked()).ToLocalChecked()->NumberValue(); + } + if (Nan::Has(obj, Nan::New("center").ToLocalChecked()).FromJust()) { auto center = Nan::Get(obj, Nan::New("center").ToLocalChecked()).ToLocalChecked().As(); if (center->Length() > 0) { options->latitude = Nan::Get(center, 0).ToLocalChecked()->NumberValue(); } @@ -288,6 +293,7 @@ void NodeMap::startRender(std::unique_ptr options) { map->setClasses(options->classes); map->setLatLngZoom(mbgl::LatLng(options->latitude, options->longitude), options->zoom); map->setBearing(options->bearing); + map->setPitch(options->pitch); map->renderStill([this](const std::exception_ptr eptr, std::unique_ptr result) { if (eptr) {