Skip to content

Commit

Permalink
Merge pull request #571 from Sharktheone/layout/fix-percentages
Browse files Browse the repository at this point in the history
fix percentages being off by factor 100
  • Loading branch information
Sharktheone authored Aug 27, 2024
2 parents ff8c700 + f64f9fb commit 7291b75
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion crates/gosub_styling/src/syntax_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
4 changes: 0 additions & 4 deletions crates/gosub_taffy/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,10 +218,6 @@ impl<LT: LayoutTree<TaffyLayouter>> 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);
}

Expand Down
6 changes: 3 additions & 3 deletions crates/gosub_taffy/src/style/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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())
Expand All @@ -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())
Expand Down

0 comments on commit 7291b75

Please sign in to comment.