summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/node_map.cpp9
-rw-r--r--test/js/consecutive.test.js3
-rw-r--r--test/js/gzip.test.js3
-rw-r--r--test/js/map.test.js12
-rw-r--r--test/render.test.js1
m---------vendor/mbgl0
6 files changed, 24 insertions, 4 deletions
diff --git a/src/node_map.cpp b/src/node_map.cpp
index d348d0febd..a24f0c46b8 100644
--- a/src/node_map.cpp
+++ b/src/node_map.cpp
@@ -66,7 +66,7 @@ NAN_METHOD(NodeMap::New) {
auto options = args[0]->ToObject();
- // Check that request() and cancel() are defined.
+ // Check that 'request', 'cancel' and 'ratio' are defined.
if (!options->Has(NanNew("request")) || !options->Get(NanNew("request"))->IsFunction()) {
return NanThrowError("Options object must have a 'request' method");
}
@@ -74,6 +74,10 @@ NAN_METHOD(NodeMap::New) {
return NanThrowError("Options object 'cancel' property must be a function");
}
+ if (!options->Has(NanNew("ratio")) || !options->Get(NanNew("ratio"))->IsNumber()) {
+ return NanThrowError("Options object must have a numerical 'ratio' property");
+ }
+
try {
auto nodeMap = new NodeMap(options);
nodeMap->Wrap(args.This());
@@ -193,6 +197,7 @@ NAN_METHOD(NodeMap::Render) {
void NodeMap::startRender(std::unique_ptr<NodeMap::RenderOptions> options) {
view.resize(options->width, options->height);
+ map->update(mbgl::Update::Dimensions);
map->setClasses(options->classes);
map->setLatLngZoom(mbgl::LatLng(options->latitude, options->longitude), options->zoom);
map->setBearing(options->bearing);
@@ -319,7 +324,7 @@ void NodeMap::release() {
// Instance
NodeMap::NodeMap(v8::Handle<v8::Object> options) :
- view(sharedDisplay(), 1.0),
+ view(sharedDisplay(), options->Get(NanNew("ratio"))->NumberValue()),
fs(options),
map(std::make_unique<mbgl::Map>(view, fs, mbgl::MapMode::Still)),
async(new uv_async_t) {
diff --git a/test/js/consecutive.test.js b/test/js/consecutive.test.js
index 52ed7cf688..f493e2a31c 100644
--- a/test/js/consecutive.test.js
+++ b/test/js/consecutive.test.js
@@ -24,6 +24,7 @@ function renderTest(style, info, dir, key) {
});
};
options.cancel = function() {};
+ options.ratio = 1.0;
var map = new mbgl.Map(options);
map.load(style);
@@ -50,7 +51,7 @@ function rewriteLocalSchema(uri) {
return uri.replace(/^local:\/\//, '');
}
-test('Concurrency', function(t) {
+test('Consecutive', function(t) {
var dir = 'line-join';
var k = 'round';
diff --git a/test/js/gzip.test.js b/test/js/gzip.test.js
index 537a005818..9e899604ae 100644
--- a/test/js/gzip.test.js
+++ b/test/js/gzip.test.js
@@ -50,7 +50,8 @@ function getOptions(gzip, t) {
response.data = res.body;
req.respond(null, response);
});
- }
+ },
+ ratio: 1.0
};
}
diff --git a/test/js/map.test.js b/test/js/map.test.js
index 21369fd382..4586ceeed4 100644
--- a/test/js/map.test.js
+++ b/test/js/map.test.js
@@ -65,6 +65,16 @@ test('Map', function(t) {
}, /Options object 'cancel' property must be a function/);
options.cancel = function() {};
+ t.throws(function() {
+ new mbgl.Map(options);
+ }, /Options object must have a numerical 'ratio' property/);
+
+ options.ratio = 'test';
+ t.throws(function() {
+ new mbgl.Map(options);
+ }, /Options object must have a numerical 'ratio' property/);
+
+ options.ratio = 1.0;
t.doesNotThrow(function() {
new mbgl.Map(options);
});
@@ -79,6 +89,7 @@ test('Map', function(t) {
var options = {};
options.request = function() {};
options.cancel = function() {};
+ options.ratio = 1.0;
t.test('requires a string or object as the first parameter', function(t) {
t.test('requires a map style as first argument', function(t) {
@@ -159,6 +170,7 @@ test('Map', function(t) {
});
};
options.cancel = function() {};
+ options.ratio = 1.0;
t.test('requires an object as the first parameter', function(t) {
setup(options, function(map) {
diff --git a/test/render.test.js b/test/render.test.js
index 2468b72423..b55841fef0 100644
--- a/test/render.test.js
+++ b/test/render.test.js
@@ -47,6 +47,7 @@ function renderTest(style, info, base, key) {
});
};
options.cancel = function() {};
+ options.ratio = 1.0;
var map = new mbgl.Map(options);
map.load(style);
diff --git a/vendor/mbgl b/vendor/mbgl
-Subproject b5f918af7cf69b2897b8c92d244722c5c58fce5
+Subproject 5d038fbd840717b606a15b825015958228d4245