Added comments

This commit is contained in:
Alexei Anoshenko 2024-10-21 18:37:35 +03:00
parent daf41dd7e0
commit b65b7f6df8
5 changed files with 61 additions and 16 deletions

View File

@ -260,7 +260,14 @@ func newBorderProperty(value any) BorderProperty {
return border 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 { func NewBorder(params Params) BorderProperty {
border := new(borderProperty) border := new(borderProperty)
border.properties = map[string]any{} border.properties = map[string]any{}

View File

@ -19,7 +19,8 @@ type boundsPropertyData struct {
propertyList 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 { func NewBoundsProperty(params Params) BoundsProperty {
bounds := new(boundsPropertyData) bounds := new(boundsPropertyData)
bounds.properties = map[string]any{} bounds.properties = map[string]any{}

View File

@ -57,7 +57,14 @@ func newColumnSeparatorProperty(value any) ColumnSeparatorProperty {
return nil 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 { func NewColumnSeparator(params Params) ColumnSeparatorProperty {
separator := new(columnSeparatorProperty) separator := new(columnSeparatorProperty)
separator.properties = map[string]any{} separator.properties = map[string]any{}

View File

@ -19,6 +19,12 @@ type outlinePropertyData struct {
propertyList 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 { func NewOutlineProperty(params Params) OutlineProperty {
outline := new(outlinePropertyData) outline := new(outlinePropertyData)
outline.properties = map[string]any{} outline.properties = map[string]any{}

View File

@ -47,7 +47,7 @@ const (
// Inset is the constant for "inset" property tag. // Inset is the constant for "inset" property tag.
// //
// Used by `ViewShadow`. // 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. // ones), above the background, but below content.
// //
// Supported types: `bool`, `int`, `string`. // Supported types: `bool`, `int`, `string`.
@ -82,7 +82,7 @@ const (
// BlurRadius is the constant for "blur" property tag. // BlurRadius is the constant for "blur" property tag.
// //
// Used by `ViewShadow`. // 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. // lighter. Negative values are not allowed.
// //
// Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`. // Supported types: `SizeUnit`, `SizeFunc`, `string`, `float`, `int`.
@ -118,10 +118,14 @@ type viewShadowData struct {
} }
// NewViewShadow create the new shadow for a view. Arguments: // 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 // offsetX, offsetY is x and y offset of the shadow;
// spreadRadius - the spread radius of the shadow //
// color - the color 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 { func NewViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow {
return NewShadowWithParams(Params{ return NewShadowWithParams(Params{
XOffset: offsetX, 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: // 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 // offsetX, offsetY is x and y offset of the shadow;
// spreadRadius - the spread radius of the shadow //
// color - the color 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 { func NewInsetViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, color Color) ViewShadow {
return NewShadowWithParams(Params{ return NewShadowWithParams(Params{
XOffset: offsetX, XOffset: offsetX,
@ -149,9 +157,12 @@ func NewInsetViewShadow(offsetX, offsetY, blurRadius, spreadRadius SizeUnit, col
} }
// NewTextShadow create the new text shadow. Arguments: // NewTextShadow create the new text shadow. Arguments:
// offsetX, offsetY - x and y offset of the shadow //
// blurRadius - the blur radius of the shadow // offsetX, offsetY is the x- and y-offset of the shadow;
// color - the color 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 { func NewTextShadow(offsetX, offsetY, blurRadius SizeUnit, color Color) ViewShadow {
return NewShadowWithParams(Params{ return NewShadowWithParams(Params{
XOffset: offsetX, XOffset: offsetX,
@ -162,6 +173,19 @@ func NewTextShadow(offsetX, offsetY, blurRadius SizeUnit, color Color) ViewShado
} }
// NewShadowWithParams create the new shadow for a view. // 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 { func NewShadowWithParams(params Params) ViewShadow {
shadow := new(viewShadowData) shadow := new(viewShadowData)
shadow.propertyList.init() shadow.propertyList.init()