Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix percentages being off by factor 100 #571

Merged
merged 1 commit into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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