From 8e148ac4ee24b4339b0638fbe5bf4dbfc76d3ce3 Mon Sep 17 00:00:00 2001 From: CatHood0 Date: Tue, 9 Jul 2024 16:23:44 -0400 Subject: [PATCH] chore: fixed documentation can't be watched for line-height and size parsers --- lib/parser/font_size_parser.dart | 16 +++++++++++----- lib/parser/line_height_parser.dart | 3 ++- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/lib/parser/font_size_parser.dart b/lib/parser/font_size_parser.dart index 036702e..02c1def 100644 --- a/lib/parser/font_size_parser.dart +++ b/lib/parser/font_size_parser.dart @@ -1,3 +1,14 @@ +// constant centimeters multiplier +const double cmSizeMultiplier = 37.7952755906; +// constant millimeters multiplier +const double mmSizeMultiplier = 3.7795275591; +// constant inches multiplier +const double inchSizeMultiplier = 96; +// constant points multiplier +const double pointSizeMultiplier = 1.3333333333; +// constant picas multiplier +const double picasSizeMultiplier = 16; + /// Converts various CSS units to pixels (px). /// /// This function supports the following units: @@ -29,11 +40,6 @@ /// [rootFontSize] is the font-size of the root element, used for `rem` units. /// /// Returns the equivalent value in pixels. -const double cmSizeMultiplier = 37.7952755906; -const double mmSizeMultiplier = 3.7795275591; -const double inchSizeMultiplier = 96; -const double pointSizeMultiplier = 1.3333333333; -const double picasSizeMultiplier = 16; double parseSizeToPx( String value, { double fontSizeEmMultiplier = 16.0, diff --git a/lib/parser/line_height_parser.dart b/lib/parser/line_height_parser.dart index 0ad4bac..7375783 100644 --- a/lib/parser/line_height_parser.dart +++ b/lib/parser/line_height_parser.dart @@ -1,3 +1,5 @@ +/// constant common line-height multiplier +const normalLineHeightMultiplier = 1.2; /// Parses a CSS `line-height` value to a pixel value based on the specified [fontSize] and optional [rootFontSize]. /// /// Supports unitless values, percentages, pixels (`px`), ems (`em`), rems (`rem`), and the keyword `normal`. @@ -25,7 +27,6 @@ /// print(parseLineHeight('1.5em')); // 24.0 (16 * 1.5) /// print(parseLineHeight('1.2rem')); // 19.2 (16 * 1.2) /// ``` -const normalLineHeightMultiplier = 1.2; double parseLineHeight(String lineHeight, {double fontSize = 16, double rootFontSize = 16}) { // Convert line-height values double parsedValue;