tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 583HTML 275Markdown 8TOML 41586 Definiciones

Document that Taffy percentages are represented by the range [0, 1] not [0, 100] (#764)

Signed-off-by: Nico Burns <nico@nicoburns.com>

5c7c914137336f5066183e82c0b9de1fe2b59241 · por Nico Burns · (hace 1 año) · padre 0120d254a · ver el árbol en este commit

Delta semántico

Ninguna definición cambió: el cambio es de texto, documentación o datos.

1 archivos · +9 −3

diff --git a/src/style/dimension.rs b/src/style/dimension.rs
index 35ee8d27a..3b2cfb3da 100644
--- a/src/style/dimension.rs
+++ b/src/style/dimension.rs
@@ -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 {
@@ -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,
@@ -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,