From b65b7f6df87482ef310d532405023db872ba0b18 Mon Sep 17 00:00:00 2001 From: Alexei Anoshenko <2277098+anoshenko@users.noreply.github.com> Date: Mon, 21 Oct 2024 18:37:35 +0300 Subject: [PATCH] Added comments --- border.go | 9 ++++++++- bounds.go | 3 ++- columnSeparator.go | 9 ++++++++- outline.go | 6 ++++++ shadow.go | 50 ++++++++++++++++++++++++++++++++++------------ 5 files changed, 61 insertions(+), 16 deletions(-) diff --git a/border.go b/border.go index c88afee..19468e9 100644 --- a/border.go +++ b/border.go @@ -260,7 +260,14 @@ func newBorderProperty(value any) BorderProperty { return border } -// NewBorder creates the new BorderProperty +// NewBorder creates the new BorderProperty. +// The following properties can be used: +// +// "style" (Style). Determines the line style (int). Valid values: 0 (NoneLine), 1 (SolidLine), 2 (DashedLine), 3 (DottedLine), or 4 (DoubleLine); +// +// "color" (ColorTag). Determines the line color (Color); +// +// "width" (Width). Determines the line thickness (SizeUnit). func NewBorder(params Params) BorderProperty { border := new(borderProperty) border.properties = map[string]any{} diff --git a/bounds.go b/bounds.go index fc1ae79..ed96023 100644 --- a/bounds.go +++ b/bounds.go @@ -19,7 +19,8 @@ type boundsPropertyData struct { propertyList } -// NewBoundsProperty creates the new BoundsProperty object +// NewBoundsProperty creates the new BoundsProperty object. +// The following SizeUnit properties can be used: "left" (Left), "right" (Right), "top" (Top), and "bottom" (Bottom). func NewBoundsProperty(params Params) BoundsProperty { bounds := new(boundsPropertyData) bounds.properties = map[string]any{} diff --git a/columnSeparator.go b/columnSeparator.go index c5ca505..f4b5bca 100644 --- a/columnSeparator.go +++ b/columnSeparator.go @@ -57,7 +57,14 @@ func newColumnSeparatorProperty(value any) ColumnSeparatorProperty { return nil } -// NewColumnSeparator creates the new ColumnSeparatorProperty +// NewColumnSeparator creates the new ColumnSeparatorProperty. +// The following properties can be used: +// +// "style" (Style). Determines the line style (int). Valid values: 0 (NoneLine), 1 (SolidLine), 2 (DashedLine), 3 (DottedLine), or 4 (DoubleLine); +// +// "color" (ColorTag). Determines the line color (Color); +// +// "width" (Width). Determines the line thickness (SizeUnit). func NewColumnSeparator(params Params) ColumnSeparatorProperty { separator := new(columnSeparatorProperty) separator.properties = map[string]any{} diff --git a/outline.go b/outline.go index d9ba065..d2ef536 100644 --- a/outline.go +++ b/outline.go @@ -19,6 +19,12 @@ type outlinePropertyData struct { propertyList } +// NewOutlineProperty creates the new OutlineProperty. +// The following properties can be used: +// +// "color" (ColorTag). Determines the line color (Color); +// +// "width" (Width). Determines the line thickness (SizeUnit). func NewOutlineProperty(params Params) OutlineProperty { outline := new(outlinePropertyData) outline.properties = map[string]any{} diff --git a/shadow.go b/shadow.go index 69efc4b..8596020 100644 --- a/shadow.go +++ b/shadow.go @@ -47,7 +47,7 @@ const ( // Inset is the constant for "inset" property tag. // // Used by `ViewShadow`. - // Controls whether to draw shadow inside the frame or outside. Inset shadows are drawn inside the border(even transparent + // Controls whether to draw shadow inside the frame or outside. Inset shadows are drawn inside the border(even transparent // ones), above the background, but below content. // // Supported types: `bool`, `int`, `string`. @@ -82,7 +82,7 @@ const ( // BlurRadius is the constant for "blur" property tag. // // Used by `ViewShadow`. - // Determines the radius of the blur effect. The larger this value, the bigger the blur, so the shadow becomes bigger and + // Determines the radius of the blur effect. The larger this value, the bigger the blur, so the shadow becomes bigger and // lighter. Negative values are not allowed. // // Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. @@ -118,10 +118,14 @@ type viewShadowData struct { } // NewViewShadow create the new shadow for a view. Arguments: -// offsetX, offsetY - x and y offset of the shadow -// blurRadius - the blur radius of the shadow -// spreadRadius - the spread radius of the shadow -// color - the color of the shadow +// +// offsetX, offsetY is x and y offset of the shadow; +// +// blurRadius is the blur radius of the shadow; +// +// spreadRadius is the spread radius of the shadow; +// +// color is the color of the shadow. func NewViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow { return NewShadowWithParams(Params{ XOffset: offsetX, @@ -133,10 +137,14 @@ func NewViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Co } // NewInsetViewShadow create the new inset shadow for a view. Arguments: -// offsetX, offsetY - x and y offset of the shadow -// blurRadius - the blur radius of the shadow -// spreadRadius - the spread radius of the shadow -// color - the color of the shadow +// +// offsetX, offsetY is x and y offset of the shadow; +// +// blurRadius is the blur radius of the shadow; +// +// spreadRadius is the spread radius of the shadow; +// +// color is the color of the shadow. func NewInsetViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow { return NewShadowWithParams(Params{ XOffset: offsetX, @@ -149,9 +157,12 @@ func NewInsetViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, col } // NewTextShadow create the new text shadow. Arguments: -// offsetX, offsetY - x and y offset of the shadow -// blurRadius - the blur radius of the shadow -// color - the color of the shadow +// +// offsetX, offsetY is the x- and y-offset of the shadow; +// +// blurRadius is the blur radius of the shadow; +// +// color is the color of the shadow. func NewTextShadow(offsetX, offsetY, blurRadius SizeUnit, color Color) ViewShadow { return NewShadowWithParams(Params{ XOffset: offsetX, @@ -162,6 +173,19 @@ func NewTextShadow(offsetX, offsetY, blurRadius SizeUnit, color Color) ViewShado } // NewShadowWithParams create the new shadow for a view. +// The following properties can be used: +// +// "color" (ColorTag). Determines the color of the shadow (Color); +// +// "x-offset" (XOffset). Determines the shadow horizontal offset (SizeUnit); +// +// "y-offset" (YOffset). Determines the shadow vertical offset (SizeUnit); +// +// "blur" (BlurRadius). Determines the radius of the blur effect (SizeUnit); +// +// "spread-radius" (SpreadRadius). Positive values (SizeUnit) will cause the shadow to expand and grow bigger, negative values will cause the shadow to shrink; +// +// "inset" (Inset). Controls (bool) whether to draw shadow inside the frame or outside. func NewShadowWithParams(params Params) ViewShadow { shadow := new(viewShadowData) shadow.propertyList.init()