Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
[node] add pitch option
Browse files Browse the repository at this point in the history
  • Loading branch information
bsudekum committed Nov 3, 2015
1 parent 9067fd4 commit 93c5bc0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down
6 changes: 6 additions & 0 deletions platform/node/src/node_map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -204,6 +205,10 @@ std::unique_ptr<NodeMap::RenderOptions> NodeMap::ParseOptions(v8::Local<v8::Obje
options->bearing = 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<v8::Array>();
if (center->Length() > 0) { options->latitude = Nan::Get(center, 0).ToLocalChecked()->NumberValue(); }
Expand Down Expand Up @@ -288,6 +293,7 @@ void NodeMap::startRender(std::unique_ptr<NodeMap::RenderOptions> 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<const mbgl::StillImage> result) {
if (eptr) {
Expand Down

0 comments on commit 93c5bc0

Please sign in to comment.