mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 14:51:15 +00:00
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:
parent
ecde93a9ec
commit
ee2e08f98d
1 changed files with 3 additions and 1 deletions
|
@ -204,7 +204,9 @@ fn to_eval_value<'cx>(
|
||||||
Ok(Value::Model(sixtyfps_interpreter::ModelPtr(m)))
|
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::Bool => Ok(Value::Bool(val.downcast_or_throw::<JsBoolean, _>(cx)?.value())),
|
||||||
Type::Object { fields, .. } => {
|
Type::Object { fields, .. } => {
|
||||||
let obj = val.downcast_or_throw::<JsObject, _>(cx)?;
|
let obj = val.downcast_or_throw::<JsObject, _>(cx)?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue