Changes following "Remove API to set if a geometry requires writing to the depth...
[platform/core/uifw/dali-toolkit.git] / plugins / dali-script-v8 / src / object / property-value-wrapper.cpp
index 0b70084..8469d7f 100644 (file)
@@ -562,7 +562,7 @@ Dali::Property::Value PropertyValueWrapper::VectorOrMatrixFromV8Array( v8::Isola
   }
   if(16 == len )
   {
-    ret = Dali::Matrix( out[0] );
+    ret = Dali::Matrix( out );
   }
   else if ( 9 == len )
   {
@@ -675,6 +675,10 @@ Dali::Property::Value PropertyValueWrapper::ExtractPropertyValue( v8::Isolate* i
       {
         daliPropertyValue = Dali::Property::Value(  v8Value->Int32Value()  ) ;//static_cast<int>( V8Utils::GetNumberValue( isolate, v8Value) ));
       }
+      else if( V8Utils::IsStringPrimitiveOrObject( v8Value) ) // Take string as value for properties that internally convert the string to an enum
+      {
+        daliPropertyValue = Dali::Property::Value( V8Utils::GetStringValue( isolate, v8Value) );
+      }
       break;
     }
     case Dali::Property::STRING:
@@ -754,14 +758,31 @@ Dali::Property::Value PropertyValueWrapper::ExtractPropertyValue( v8::Isolate* i
       daliPropertyValue = ArrayFromV8Array( isolate, v8Value );
       break;
     }
+    case Dali::Property::MAP:
+    {
+      if( v8Value->IsObject() )
+      {
+        v8::Local<v8::Object> object = v8::Handle<v8::Object>::Cast(v8Value);
+        Dali::Property::Map propertyMap = V8Utils::GetPropertyMapFromObject(isolate, object);
+        daliPropertyValue = Dali::Property::Value( propertyMap );
+      }
+      else if( V8Utils::IsStringPrimitiveOrObject( v8Value) )
+      {
+        // There are special cases where a property with property map type can accept a string value,
+        // so we do the additional check here.
+        daliPropertyValue = Dali::Property::Value( V8Utils::GetStringValue( isolate, v8Value) );
+      }
+
+      break;
+    }
     case Dali::Property::NONE:
     default:
     {
       break;
     }
-   } // switch type
+  } // switch type
 
-   return daliPropertyValue;
+  return daliPropertyValue;
 }
 
 void PropertyValueWrapper::NewRotation( const v8::FunctionCallbackInfo< v8::Value >& args)