summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package.json2
-rw-r--r--platform/node/src/node_style.hpp18
-rw-r--r--platform/node/src/node_style_properties.hpp2
-rw-r--r--platform/node/src/node_style_properties.hpp.ejs2
4 files changed, 23 insertions, 1 deletions
diff --git a/package.json b/package.json
index 71bfd9bf98..053083fb07 100644
--- a/package.json
+++ b/package.json
@@ -23,7 +23,7 @@
"express": "^4.11.1",
"mapbox-gl-shaders": "mapbox/mapbox-gl-shaders#59e998295d548f208ee3ec10cdd21ff2630e2079",
"mapbox-gl-style-spec": "mapbox/mapbox-gl-style-spec#194fc55b6a7dd54c1e2cf2dd9048fbb5e836716d",
- "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#2e95c51a6ed0efd1d8cda03f6b5391a6639900ae",
+ "mapbox-gl-test-suite": "mapbox/mapbox-gl-test-suite#87d237a9d7372325fffd0c04036b2d77e601e72b",
"node-gyp": "^3.3.1",
"request": "^2.72.0",
"tape": "^4.5.1"
diff --git a/platform/node/src/node_style.hpp b/platform/node/src/node_style.hpp
index 032e0c8a43..9befd00d10 100644
--- a/platform/node/src/node_style.hpp
+++ b/platform/node/src/node_style.hpp
@@ -46,4 +46,22 @@ PropertySetter makePropertySetter(void (L::*setter)(mbgl::style::PropertyValue<V
};
}
+inline bool setVisibility(mbgl::style::Layer& layer, const v8::Local<v8::Value>& value) {
+ if (value->IsNull() || value->IsUndefined()) {
+ layer.setVisibility(mbgl::style::VisibilityType::Visible);
+ return true;
+ }
+
+ if (!value->IsString()) {
+ Nan::ThrowTypeError("visibility value must be \"visible\" or \"none\"");
+ return false;
+ }
+
+ layer.setVisibility(std::string(*Nan::Utf8String(value)) == "none"
+ ? mbgl::style::VisibilityType::None
+ : mbgl::style::VisibilityType::Visible);
+
+ return true;
+}
+
}
diff --git a/platform/node/src/node_style_properties.hpp b/platform/node/src/node_style_properties.hpp
index 88142f8e1f..1ad06068f3 100644
--- a/platform/node/src/node_style_properties.hpp
+++ b/platform/node/src/node_style_properties.hpp
@@ -13,6 +13,8 @@ inline PropertySetters makeLayoutPropertySetters() {
using namespace mbgl::style;
PropertySetters result;
+ result["visibility"] = &setVisibility;
+
result["line-cap"] = makePropertySetter(&LineLayer::setLineCap);
result["line-join"] = makePropertySetter(&LineLayer::setLineJoin);
diff --git a/platform/node/src/node_style_properties.hpp.ejs b/platform/node/src/node_style_properties.hpp.ejs
index 1937421fa5..ebf45eb3cf 100644
--- a/platform/node/src/node_style_properties.hpp.ejs
+++ b/platform/node/src/node_style_properties.hpp.ejs
@@ -10,6 +10,8 @@ inline PropertySetters makeLayoutPropertySetters() {
using namespace mbgl::style;
PropertySetters result;
+ result["visibility"] = &setVisibility;
+
<% for (const layer of locals.layers) { -%>
<% for (const property of layer.layoutProperties) { -%>
result["<%- property.name %>"] = makePropertySetter(&<%- camelize(layer.type) %>Layer::set<%- camelize(property.name) %>);