diff options
author | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-19 20:05:05 -0700 |
---|---|---|
committer | John Firebaugh <john.firebaugh@gmail.com> | 2016-06-21 16:04:22 -0700 |
commit | 8a9ee26b0e00a899a77c265d6d5e33b3aa11b582 (patch) | |
tree | 59a7f4ce0a0ca335602eb427f1e764a8a9350aae /platform/node/src/node_map.cpp | |
parent | a18d6dda5de5247b14611a3bd901fdf65e13beeb (diff) | |
download | qtlocation-mapboxgl-8a9ee26b0e00a899a77c265d6d5e33b3aa11b582.tar.gz |
[core] Use mbgl::style::conversion in node bindings
Diffstat (limited to 'platform/node/src/node_map.cpp')
-rw-r--r-- | platform/node/src/node_map.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/platform/node/src/node_map.cpp b/platform/node/src/node_map.cpp index b4ea77000b..c416082b69 100644 --- a/platform/node/src/node_map.cpp +++ b/platform/node/src/node_map.cpp @@ -56,6 +56,7 @@ NAN_MODULE_INIT(NodeMap::Init) { Nan::SetPrototypeMethod(tpl, "release", Release); Nan::SetPrototypeMethod(tpl, "addClass", AddClass); + Nan::SetPrototypeMethod(tpl, "setLayoutProperty", SetLayoutProperty); Nan::SetPrototypeMethod(tpl, "setPaintProperty", SetPaintProperty); Nan::SetPrototypeMethod(tpl, "dumpDebugLogs", DumpDebugLogs); @@ -481,7 +482,7 @@ NAN_METHOD(NodeMap::AddClass) { info.GetReturnValue().SetUndefined(); } -NAN_METHOD(NodeMap::SetPaintProperty) { +void NodeMap::setProperty(const Nan::FunctionCallbackInfo<v8::Value>& info, const PropertySetters& setters) { auto nodeMap = Nan::ObjectWrap::Unwrap<NodeMap>(info.Holder()); if (!nodeMap->map) return Nan::ThrowError(releasedMessage()); @@ -502,8 +503,6 @@ NAN_METHOD(NodeMap::SetPaintProperty) { return Nan::ThrowTypeError("Second argument must be a string"); } - static const PropertySetters setters = makePaintPropertySetters(); - auto it = setters.find(*Nan::Utf8String(info[1])); if (it == setters.end()) { return Nan::ThrowTypeError("property not found"); @@ -517,6 +516,16 @@ NAN_METHOD(NodeMap::SetPaintProperty) { info.GetReturnValue().SetUndefined(); } +NAN_METHOD(NodeMap::SetLayoutProperty) { + static const PropertySetters setters = makeLayoutPropertySetters(); + setProperty(info, setters); +} + +NAN_METHOD(NodeMap::SetPaintProperty) { + static const PropertySetters setters = makePaintPropertySetters(); + setProperty(info, setters); +} + NAN_METHOD(NodeMap::DumpDebugLogs) { auto nodeMap = Nan::ObjectWrap::Unwrap<NodeMap>(info.Holder()); if (!nodeMap->map) return Nan::ThrowError(releasedMessage()); |