Script v1.7.1.0
- AI
- Animals
- Contracts
- Debug
- Economy
- Effects
- Events
- Farms
- GUI
- AnimalScreen
- AnimationElement
- BitmapElement
- BoxLayoutElement
- BreadcrumbsElement
- ButtonElement
- ButtonOverlay
- ChatWindow
- CheckedOptionElement
- ClearElement
- ContextActionDisplay
- DialogElement
- FieldInfoDisplay
- FillLevelsDisplay
- FlowLayoutElement
- FocusManager
- FrameElement
- FrameReferenceElement
- GameInfoDisplay
- GamePausedDisplay
- Gui
- GuiDataSource
- GuiElement
- GuiMixin
- GuiOverlay
- GuiProfile
- GuiSoundPlayer
- GuiTopDownCamera
- GuiUtils
- HUDDisplayElement
- HUDElement
- HUDFrameElement
- HUDPopupMessage
- HUDTextDisplay
- IndexChangeSubjectMixin
- IndexStateElement
- InGameIcon
- IngameMap
- IngameMapElement
- InputGlyphElement
- InputHelpDisplay
- ListElement
- ListItemElement
- MapHotspot
- MapOverlayGenerator
- MixerWagonHUDExtension
- MultiTextOptionElement
- MultiValueTween
- Overlay
- PagingElement
- PlaySampleMixin
- RenderElement
- RoundStatusBar
- ScreenElement
- SettingsModel
- SideNotification
- SliderElement
- SpeakerDisplay
- SpeedMeterDisplay
- StableListElement
- StatusBar
- TabbedMenu
- TabbedMenuFrameElement
- TabbedMenuWithDetails
- TableElement
- TableHeaderElement
- TextElement
- TextInputElement
- TimerElement
- ToggleButtonElement
- TopNotification
- Tween
- TweenSequence
- VehicleHUDExtension
- VehicleSchemaDisplay
- VideoElement
- Handtools
- I3d
- Materials
- Misc
- Objects
- Placeables
- Player
- Shop
- Sounds
- Specializations
- Triggers
- Utils
- Vehicles
- Weather
Engine v1.7.1.0
- AI
- Animation
- Camera
- Entity
- Fillplanes
- General
- I3D
- Input
- Lighting
- Math
- Network
- Node
- Overlays
- Particle System
- Physics
- Rendering
- Scenegraph
- Shape
- Sound
- Spline
- String
- Terrain Detail
- Text Rendering
- Tire Track
- XML
- general
Foundation Reference
FlowLayoutElement
DescriptionHorizontal flow layouting element for simple cases.Parent
BoxLayoutElementFunctions
invalidateLayout
DescriptionDefinitioninvalidateLayout()Code
27 | function FlowLayoutElement:invalidateLayout(ignoreVisibility) |
28 | local totalWidth = 0 |
29 | for _, element in pairs(self.elements) do |
30 | if self:getIsElementIncluded(element, ignoreVisibility) then |
31 | totalWidth = totalWidth + element.size[1] + element.margin[1] + element.margin[3] |
32 | end |
33 | end |
34 | |
35 | local posX = 0 |
36 | if self.alignmentX == FlowLayoutElement.ALIGN_CENTER then |
37 | posX = self.size[1]*0.5 - totalWidth*0.5 |
38 | elseif self.alignmentX == FlowLayoutElement.ALIGN_RIGHT then |
39 | posX = self.size[1] - totalWidth |
40 | end |
41 | |
42 | for _, element in pairs(self.elements) do |
43 | if self:getIsElementIncluded(element, ignoreVisibility) then |
44 | posX = posX + element.margin[1] |
45 | local posY = element.margin[4] |
46 | if self.alignmentY == FlowLayoutElement.ALIGN_MIDDLE then |
47 | posY = self.size[2]*0.5 - element.size[2]*0.5 |
48 | elseif self.alignmentY == FlowLayoutElement.ALIGN_TOP then |
49 | posY = self.size[2] - element.size[2] |
50 | end |
51 | |
52 | element:setPosition(posX, posY) |
53 | posX = posX + element.size[1] + element.margin[3] |
54 | end |
55 | end |
56 | end |
new
DescriptionDefinitionnew()Code
16 | function FlowLayoutElement:new(target, custom_mt) |
17 | local self = BoxLayoutElement:new(target, custom_mt or FlowLayoutElement_mt) |
18 | |
19 | self.alignmentX = BoxLayoutElement.ALIGN_LEFT |
20 | self.alignmentY = BoxLayoutElement.ALIGN_BOTTOM |
21 | |
22 | return self |
23 | end |