diff options
Diffstat (limited to 'platform/node')
-rw-r--r-- | platform/node/src/node_expression.cpp | 4 | ||||
-rw-r--r-- | platform/node/src/node_map.cpp | 28 | ||||
-rw-r--r-- | platform/node/src/node_map.hpp | 1 | ||||
-rw-r--r-- | platform/node/test/ignores.json | 8 | ||||
-rw-r--r-- | platform/node/test/js/map.test.js | 1 |
5 files changed, 39 insertions, 3 deletions
diff --git a/platform/node/src/node_expression.cpp b/platform/node/src/node_expression.cpp index 84515060a3..27866ccbed 100644 --- a/platform/node/src/node_expression.cpp +++ b/platform/node/src/node_expression.cpp @@ -75,8 +75,8 @@ void NodeExpression::Parse(const Nan::FunctionCallbackInfo<v8::Value>& info) { auto expr = info[0]; try { - ParsingContext ctx(expected); - ParseResult parsed = ctx.parse(mbgl::style::conversion::Convertible(expr)); + ParsingContext ctx = expected ? ParsingContext(*expected) : ParsingContext(); + ParseResult parsed = ctx.parseLayerPropertyExpression(mbgl::style::conversion::Convertible(expr)); if (parsed) { assert(ctx.getErrors().size() == 0); auto nodeExpr = new NodeExpression(std::move(*parsed)); diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index 0fe69e8ac9..9b76f0f542 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -74,6 +74,7 @@ void NodeMap::Init(v8::Local<v8::Object> target) { Nan::SetPrototypeMethod(tpl, "removeLayer", RemoveLayer); Nan::SetPrototypeMethod(tpl, "addImage", AddImage); Nan::SetPrototypeMethod(tpl, "removeImage", RemoveImage); + Nan::SetPrototypeMethod(tpl, "setLayerZoomRange", SetLayerZoomRange); Nan::SetPrototypeMethod(tpl, "setLayoutProperty", SetLayoutProperty); Nan::SetPrototypeMethod(tpl, "setPaintProperty", SetPaintProperty); Nan::SetPrototypeMethod(tpl, "setFilter", SetFilter); @@ -740,6 +741,33 @@ void NodeMap::RemoveImage(const Nan::FunctionCallbackInfo<v8::Value>& info) { nodeMap->map->getStyle().removeImage(*Nan::Utf8String(info[0])); } + +void NodeMap::SetLayerZoomRange(const Nan::FunctionCallbackInfo<v8::Value>& info) { + using namespace mbgl::style; + + auto nodeMap = Nan::ObjectWrap::Unwrap<NodeMap>(info.Holder()); + if (!nodeMap->map) return Nan::ThrowError(releasedMessage()); + + if (info.Length() != 3) { + return Nan::ThrowTypeError("Three arguments required"); + } + + if (!info[0]->IsString()) { + return Nan::ThrowTypeError("First argument must be a string"); + } + + if (!info[1]->IsNumber() || !info[2]->IsNumber()) { + return Nan::ThrowTypeError("Second and third arguments must be numbers"); + } + + mbgl::style::Layer* layer = nodeMap->map->getStyle().getLayer(*Nan::Utf8String(info[0])); + if (!layer) { + return Nan::ThrowTypeError("layer not found"); + } + + layer->setMinZoom(info[1]->NumberValue()); + layer->setMaxZoom(info[2]->NumberValue()); +} void NodeMap::SetLayoutProperty(const Nan::FunctionCallbackInfo<v8::Value>& info) { using namespace mbgl::style; diff --git a/platform/node/src/node_map.hpp b/platform/node/src/node_map.hpp index efa6f6cee0..7fe23ad86a 100644 --- a/platform/node/src/node_map.hpp +++ b/platform/node/src/node_map.hpp @@ -50,6 +50,7 @@ public: static void RemoveLayer(const Nan::FunctionCallbackInfo<v8::Value>&); static void AddImage(const Nan::FunctionCallbackInfo<v8::Value>&); static void RemoveImage(const Nan::FunctionCallbackInfo<v8::Value>&); + static void SetLayerZoomRange(const Nan::FunctionCallbackInfo<v8::Value>&); static void SetLayoutProperty(const Nan::FunctionCallbackInfo<v8::Value>&); static void SetPaintProperty(const Nan::FunctionCallbackInfo<v8::Value>&); static void SetFilter(const Nan::FunctionCallbackInfo<v8::Value>&); diff --git a/platform/node/test/ignores.json b/platform/node/test/ignores.json index 42751da30f..e0c2475b75 100644 --- a/platform/node/test/ignores.json +++ b/platform/node/test/ignores.json @@ -1,4 +1,8 @@ { + "query-tests/circle-pitch-scale/viewport-inside-align-map": "https://github.com/mapbox/mapbox-gl-native/issues/10615", + "query-tests/circle-pitch-scale/viewport-inside-align-viewport": "https://github.com/mapbox/mapbox-gl-native/issues/10615", + "query-tests/edge-cases/box-cutting-antimeridian-z0": "https://github.com/mapbox/mapbox-gl-native/issues/11607", + "query-tests/edge-cases/null-island": "https://github.com/mapbox/mapbox-gl-native/issues/11607", "query-tests/geometry/multilinestring": "needs investigation", "query-tests/geometry/multipolygon": "needs investigation", "query-tests/geometry/polygon": "needs investigation", @@ -25,13 +29,15 @@ "render-tests/geojson/inline-polygon-symbol": "behavior needs reconciliation with gl-js", "render-tests/mixed-zoom/z10-z11": "https://github.com/mapbox/mapbox-gl-native/issues/10397", "render-tests/raster-masking/overlapping-zoom": "https://github.com/mapbox/mapbox-gl-native/issues/10195", + "render-tests/real-world/bangkok": "https://github.com/mapbox/mapbox-gl-native/issues/10412", + "render-tests/real-world/chicago": "https://github.com/mapbox/mapbox-gl-native/issues/10412", + "render-tests/real-world/sanfrancisco": "https://github.com/mapbox/mapbox-gl-native/issues/10412", "render-tests/regressions/mapbox-gl-js#2305": "https://github.com/mapbox/mapbox-gl-native/issues/6927", "render-tests/regressions/mapbox-gl-js#2467": "https://github.com/mapbox/mapbox-gl-native/issues/10619", "render-tests/regressions/mapbox-gl-js#2762": "https://github.com/mapbox/mapbox-gl-native/issues/10619", "render-tests/regressions/mapbox-gl-js#2769": "https://github.com/mapbox/mapbox-gl-native/issues/10619", "render-tests/regressions/mapbox-gl-js#3682": "https://github.com/mapbox/mapbox-gl-js/issues/3682", "render-tests/regressions/mapbox-gl-js#5370": "skip - https://github.com/mapbox/mapbox-gl-native/pull/9439", - "render-tests/regressions/mapbox-gl-js#5599": "https://github.com/mapbox/mapbox-gl-native/issues/10399", "render-tests/regressions/mapbox-gl-js#5740": "https://github.com/mapbox/mapbox-gl-native/issues/10619", "render-tests/regressions/mapbox-gl-js#5982": "https://github.com/mapbox/mapbox-gl-native/issues/10619", "render-tests/regressions/mapbox-gl-native#7357": "https://github.com/mapbox/mapbox-gl-native/issues/7357", diff --git a/platform/node/test/js/map.test.js b/platform/node/test/js/map.test.js index 81c15f9c1b..ce22816ef2 100644 --- a/platform/node/test/js/map.test.js +++ b/platform/node/test/js/map.test.js @@ -114,6 +114,7 @@ test('Map', function(t) { 'removeLayer', 'addImage', 'removeImage', + 'setLayerZoomRange', 'setLayoutProperty', 'setPaintProperty', 'setFilter', |