From f64f9fb8d72b02db15f47a5a72aa6af4f0b97b3c Mon Sep 17 00:00:00 2001 From: Shark Date: Tue, 27 Aug 2024 02:00:49 +0200 Subject: [PATCH] fix percentages being off by factor 100 --- crates/gosub_styling/src/syntax_matcher.rs | 2 +- crates/gosub_taffy/src/lib.rs | 4 ---- crates/gosub_taffy/src/style/parse.rs | 6 +++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/crates/gosub_styling/src/syntax_matcher.rs b/crates/gosub_styling/src/syntax_matcher.rs index 8ab202806..b44d97991 100644 --- a/crates/gosub_styling/src/syntax_matcher.rs +++ b/crates/gosub_styling/src/syntax_matcher.rs @@ -306,7 +306,7 @@ fn match_component_single<'a>( _ => {} }, _ => { - println!("unknown datatype: {datatype:?}"); + // println!("unknown datatype: {datatype:?}"); return first_match(input); } // _ => panic!("Unknown built-in datatype: {:?}", datatype), diff --git a/crates/gosub_taffy/src/lib.rs b/crates/gosub_taffy/src/lib.rs index 23807e46b..79f7d9572 100644 --- a/crates/gosub_taffy/src/lib.rs +++ b/crates/gosub_taffy/src/lib.rs @@ -218,10 +218,6 @@ impl> LayoutPartialTree for LayoutDocument<'_, LT> let node_id = LT::NodeId::from(node_id.into()); - if self.0.child_count(node_id) == 0 { - println!("Setting layout for leaf node: {:?}", layout); - } - self.0.set_layout(node_id, layout); } diff --git a/crates/gosub_taffy/src/style/parse.rs b/crates/gosub_taffy/src/style/parse.rs index 52e2260bc..ca099a17d 100644 --- a/crates/gosub_taffy/src/style/parse.rs +++ b/crates/gosub_taffy/src/style/parse.rs @@ -15,7 +15,7 @@ pub fn parse_len(node: &mut impl Node, name: &str) -> LengthPercentage { property.compute_value(); if let Some(percent) = property.as_percentage() { - return LengthPercentage::Percent(percent); + return LengthPercentage::Percent(percent / 100.0); } LengthPercentage::Length(property.unit_to_px()) @@ -35,7 +35,7 @@ pub fn parse_len_auto(node: &mut impl Node, name: &str) -> LengthPercentageAuto } if let Some(percent) = property.as_percentage() { - return LengthPercentageAuto::Percent(percent); + return LengthPercentageAuto::Percent(percent / 100.0); } LengthPercentageAuto::Length(property.unit_to_px()) @@ -55,7 +55,7 @@ pub fn parse_dimension(node: &mut impl Node, name: &str) -> Dimension { } if let Some(percent) = property.as_percentage() { - return Dimension::Percent(percent); + return Dimension::Percent(percent / 100.0); } Dimension::Length(property.unit_to_px())