Skip to content

Commit

Permalink
Document that Taffy percentages are represented by the range [0, 1] n…
Browse files Browse the repository at this point in the history
…ot [0, 100] (#764)

Signed-off-by: Nico Burns <nico@nicoburns.com>
  • Loading branch information
nicoburns authored Dec 16, 2024
1 parent 0120d25 commit 5c7c914
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/style/dimension.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ pub enum LengthPercentage {
/// An absolute length in some abstract units. Users of Taffy may define what they correspond
/// to in their application (pixels, logical pixels, mm, etc) as they see fit.
Length(f32),
/// The dimension is stored in percentage relative to the parent item.
/// A percentage length relative to the size of the containing block.
///
/// **NOTE: percentages are represented as a f32 value in the range [0.0, 1.0] NOT the range [0.0, 100.0]**
Percent(f32),
}
impl TaffyZero for LengthPercentage {
Expand All @@ -39,7 +41,9 @@ pub enum LengthPercentageAuto {
/// An absolute length in some abstract units. Users of Taffy may define what they correspond
/// to in their application (pixels, logical pixels, mm, etc) as they see fit.
Length(f32),
/// The dimension is stored in percentage relative to the parent item.
/// A percentage length relative to the size of the containing block.
///
/// **NOTE: percentages are represented as a f32 value in the range [0.0, 1.0] NOT the range [0.0, 100.0]**
Percent(f32),
/// The dimension should be automatically computed
Auto,
Expand Down Expand Up @@ -100,7 +104,9 @@ pub enum Dimension {
/// An absolute length in some abstract units. Users of Taffy may define what they correspond
/// to in their application (pixels, logical pixels, mm, etc) as they see fit.
Length(f32),
/// The dimension is stored in percentage relative to the parent item.
/// A percentage length relative to the size of the containing block.
///
/// **NOTE: percentages are represented as a f32 value in the range [0.0, 1.0] NOT the range [0.0, 100.0]**
Percent(f32),
/// The dimension should be automatically computed
Auto,
Expand Down

0 comments on commit 5c7c914

Please sign in to comment.