@@ -2,7 +2,7 @@ local elementManager = require("elementManager")
22local Container = elementManager .getElement (" Container" )
33--- @configDescription A flexbox container that arranges its children in a flexible layout.
44
5- --- This is the Flexbox class. It is a container that arranges its children in a flexible layout.
5+ --- This is the FlexBox class. It is a container that arranges its children in a flexible layout.
66--- @usage local flex = main:addFlexbox({background=colors.black, width=30, height=10})
77--- @usage flex:addButton():setFlexGrow(1)
88--- @usage flex:addButton():setFlexGrow(1)
@@ -12,16 +12,16 @@ local Container = elementManager.getElement("Container")
1212--- @usage flex:addButton():setFlexGrow(1) -- The flex-grow property defines the ability for a flex item to grow if necessary.
1313--- @usage flex:addButton():setFlexShrink(1) -- The flex-shrink property defines the ability for a flex item to shrink if necessary.
1414--- @usage flex:addButton():setFlexBasis(1) -- The flex-basis property defines the default size of an element before the remaining space is distributed.
15- --- @class Flexbox : Container
16- local Flexbox = setmetatable ({}, Container )
17- Flexbox .__index = Flexbox
15+ --- @class FlexBox : Container
16+ local FlexBox = setmetatable ({}, Container )
17+ FlexBox .__index = FlexBox
1818
1919--- @property flexDirection string "row" The direction of the flexbox layout "row" or "column"
20- Flexbox .defineProperty (Flexbox , " flexDirection" , {default = " row" , type = " string" })
20+ FlexBox .defineProperty (FlexBox , " flexDirection" , {default = " row" , type = " string" })
2121--- @property flexSpacing number 1 The spacing between flex items
22- Flexbox .defineProperty (Flexbox , " flexSpacing" , {default = 1 , type = " number" })
22+ FlexBox .defineProperty (FlexBox , " flexSpacing" , {default = 1 , type = " number" })
2323--- @property flexJustifyContent string "flex-start" The alignment of flex items along the main axis
24- Flexbox .defineProperty (Flexbox , " flexJustifyContent" , {
24+ FlexBox .defineProperty (FlexBox , " flexJustifyContent" , {
2525 default = " flex-start" ,
2626 type = " string" ,
2727 setter = function (self , value )
@@ -32,7 +32,7 @@ Flexbox.defineProperty(Flexbox, "flexJustifyContent", {
3232 end
3333})
3434--- @property flexAlignItems string "flex-start" The alignment of flex items along the cross axis
35- Flexbox .defineProperty (Flexbox , " flexAlignItems" , {
35+ FlexBox .defineProperty (FlexBox , " flexAlignItems" , {
3636 default = " flex-start" ,
3737 type = " string" ,
3838 setter = function (self , value )
@@ -43,11 +43,11 @@ Flexbox.defineProperty(Flexbox, "flexAlignItems", {
4343 end
4444})
4545--- @property flexCrossPadding number 0 The padding on both sides of the cross axis
46- Flexbox .defineProperty (Flexbox , " flexCrossPadding" , {default = 0 , type = " number" })
46+ FlexBox .defineProperty (FlexBox , " flexCrossPadding" , {default = 0 , type = " number" })
4747--- @property flexWrap boolean false Whether to wrap flex items onto multiple lines
4848--- @property flexUpdateLayout boolean false Whether to update the layout of the flexbox
49- Flexbox .defineProperty (Flexbox , " flexWrap" , {default = false , type = " boolean" })
50- Flexbox .defineProperty (Flexbox , " flexUpdateLayout" , {default = false , type = " boolean" })
49+ FlexBox .defineProperty (FlexBox , " flexWrap" , {default = false , type = " boolean" })
50+ FlexBox .defineProperty (FlexBox , " flexUpdateLayout" , {default = false , type = " boolean" })
5151
5252local lineBreakElement = {
5353 getHeight = function (self ) return 0 end ,
@@ -715,12 +715,12 @@ local function updateLayout(self, direction, spacing, justifyContent, wrap)
715715 self .set (" flexUpdateLayout" , false )
716716end
717717
718- --- @shortDescription Creates a new Flexbox instance
719- --- @return Flexbox object The newly created Flexbox instance
718+ --- @shortDescription Creates a new FlexBox instance
719+ --- @return FlexBox object The newly created FlexBox instance
720720--- @private
721- function Flexbox .new ()
722- local self = setmetatable ({}, Flexbox ):__init ()
723- self .class = Flexbox
721+ function FlexBox .new ()
722+ local self = setmetatable ({}, FlexBox ):__init ()
723+ self .class = FlexBox
724724 self .set (" width" , 12 )
725725 self .set (" height" , 6 )
726726 self .set (" background" , colors .blue )
@@ -741,22 +741,22 @@ function Flexbox.new()
741741 return self
742742end
743743
744- --- @shortDescription Initializes the Flexbox instance
744+ --- @shortDescription Initializes the FlexBox instance
745745--- @param props table The properties to initialize the element with
746746--- @param basalt table The basalt instance
747- --- @return Flexbox self The initialized instance
747+ --- @return FlexBox self The initialized instance
748748--- @protected
749- function Flexbox :init (props , basalt )
749+ function FlexBox :init (props , basalt )
750750 Container .init (self , props , basalt )
751- self .set (" type" , " Flexbox " )
751+ self .set (" type" , " FlexBox " )
752752 return self
753753end
754754
755755--- Adds a child element to the flexbox
756756--- @shortDescription Adds a child element to the flexbox
757757--- @param element Element The child element to add
758- --- @return Flexbox self The flexbox instance
759- function Flexbox :addChild (element )
758+ --- @return FlexBox self The flexbox instance
759+ function FlexBox :addChild (element )
760760 Container .addChild (self , element )
761761
762762 if (element ~= lineBreakElement )then
789789
790790--- @shortDescription Removes a child element from the flexbox
791791--- @param element Element The child element to remove
792- --- @return Flexbox self The flexbox instance
792+ --- @return FlexBox self The flexbox instance
793793--- @protected
794- function Flexbox :removeChild (element )
794+ function FlexBox :removeChild (element )
795795 Container .removeChild (self , element )
796796
797797 if (element ~= lineBreakElement )then
@@ -812,20 +812,20 @@ end
812812
813813--- Adds a new line break to the flexbox
814814--- @shortDescription Adds a new line break to the flexbox.
815- --- @param self Flexbox The element itself
816- --- @return Flexbox
817- function Flexbox :addLineBreak ()
815+ --- @param self FlexBox The element itself
816+ --- @return FlexBox
817+ function FlexBox :addLineBreak ()
818818 self :addChild (lineBreakElement )
819819 return self
820820end
821821
822822--- @shortDescription Renders the flexbox and its children
823823--- @protected
824- function Flexbox :render ()
824+ function FlexBox :render ()
825825 if (self .get (" flexUpdateLayout" ))then
826826 updateLayout (self , self .get (" flexDirection" ), self .get (" flexSpacing" ), self .get (" flexJustifyContent" ), self .get (" flexWrap" ))
827827 end
828828 Container .render (self )
829829end
830830
831- return Flexbox
831+ return FlexBox
0 commit comments