Skip to content

Commit

Permalink
rive script fixes (#1297)
Browse files Browse the repository at this point in the history
* rive script fixes

* debugs removed

* removed other debugs
  • Loading branch information
Heulitig authored Sep 11, 2023
1 parent cc6c4d0 commit 8e8ee9a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
16 changes: 13 additions & 3 deletions ftd/src/js/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -417,8 +417,15 @@ impl ftd::interpreter::Component {
has_rive_components,
) {
kernel_component_statements
} else if let Some(defined_component_statements) =
self.defined_component_to_component_statements(parent, index, doc, rdata, should_return)
} else if let Some(defined_component_statements) = self
.defined_component_to_component_statements(
parent,
index,
doc,
rdata,
should_return,
has_rive_components,
)
{
defined_component_statements
} else if let Some(header_defined_component_statements) = self
Expand Down Expand Up @@ -459,7 +466,7 @@ impl ftd::interpreter::Component {
) -> Option<Vec<fastn_js::ComponentStatement>> {
if ftd::js::element::is_kernel(self.name.as_str()) {
if !*has_rive_components {
*has_rive_components = ftd::js::element::is_rive_component(self.name.as_str())
*has_rive_components = ftd::js::element::is_rive_component(self.name.as_str());
}
Some(
ftd::js::Element::from_interpreter_component(self, doc).to_component_statements(
Expand All @@ -483,6 +490,7 @@ impl ftd::interpreter::Component {
doc: &ftd::interpreter::TDoc,
rdata: &ftd::js::ResolverData,
should_return: bool,
has_rive_components: &mut bool,
) -> Option<Vec<fastn_js::ComponentStatement>> {
if let Some(arguments) =
ftd::js::utils::get_set_property_values_for_provided_component_properties(
Expand All @@ -491,6 +499,7 @@ impl ftd::interpreter::Component {
self.name.as_str(),
self.properties.as_slice(),
self.line_number,
has_rive_components,
)
{
let mut component_statements = vec![];
Expand Down Expand Up @@ -563,6 +572,7 @@ impl ftd::interpreter::Component {
component_name.as_str(),
self.properties.as_slice(),
self.line_number,
has_rive_components,
)?;
} else if !ftd::js::utils::is_ui_argument(
component.arguments.as_slice(),
Expand Down
14 changes: 12 additions & 2 deletions ftd/src/js/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,7 @@ pub(crate) fn get_set_property_values_for_provided_component_properties(
component_name: &str,
component_properties: &[ftd::interpreter::Property],
line_number: usize,
has_rive_components: &mut bool,
) -> Option<Vec<(String, fastn_js::SetPropertyValue)>> {
use itertools::Itertools;

Expand All @@ -270,8 +271,17 @@ pub(crate) fn get_set_property_values_for_provided_component_properties(
arguments
.iter()
.filter_map(|v| {
v.get_optional_value(component_properties)
.map(|val| (v.name.to_string(), val.to_set_property_value(doc, rdata)))
v.get_optional_value(component_properties).map(|val| {
(
v.name.to_string(),
val.to_set_property_value_with_ui(
doc,
rdata,
has_rive_components,
false,
),
)
})
})
.collect_vec()
})
Expand Down

0 comments on commit 8e8ee9a

Please sign in to comment.