Fix creating an image resource from JS

We allow converting strings to Type::Resource, but we have to provide a
Value::Resource then, not Value::String.
This commit is contained in:
Simon Hausmann 2020-12-11 13:53:01 +01:00
parent ecde93a9ec
commit ee2e08f98d

View file

@ -204,7 +204,9 @@ fn to_eval_value<'cx>(
Ok(Value::Model(sixtyfps_interpreter::ModelPtr(m)))
}
},
Type::Resource => Ok(Value::String(val.to_string(cx)?.value().into())),
Type::Resource => {
Ok(Value::Resource(Resource::AbsoluteFilePath(val.to_string(cx)?.value().into())))
}
Type::Bool => Ok(Value::Bool(val.downcast_or_throw::<JsBoolean, _>(cx)?.value())),
Type::Object { fields, .. } => {
let obj = val.downcast_or_throw::<JsObject, _>(cx)?;