Difference between revisions of "Sprite:getLayoutInfo"

From GiderosMobile
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
__NOTOC__
 
__NOTOC__
<languages />
+
'''Available since:''' Gideros 2018.9<br/>
'''<translate>Available since</translate>:''' Gideros 2018.9<br/>
+
'''Class:''' [[Sprite]]<br/>
'''<translate>Class</translate>:''' [[Special:MyLanguage/Sprite|Sprite]]<br/>
+
 
=== <translate>Description</translate> ===
+
=== Description ===
<translate><br />
 
<br />
 
 
Returns computed placement value according to Gideros layout system.
 
Returns computed placement value according to Gideros layout system.
 +
<syntaxhighlight lang="lua">
 +
(table) = Sprite:getLayoutInfo()
 +
</syntaxhighlight>
 +
 
The returned table can contain the following fields:
 
The returned table can contain the following fields:
* '''startx''': The 0-based index of the column the child was placed into<br/>
+
* '''startx''' (number): the 0-based index of the column the child was placed into
* '''starty''': The 0-based index of the row the child was placed into<br/>
+
* '''starty''' (number): the 0-based index of the row the child was placed into
* '''width''': The width of the child<br/>
+
* '''width''' (number): the width of the child (number of columns)
* '''height''': The height of the child<br/>
+
* '''height''' (number): the height of the child (number of rows)
* '''weightx''': The horizontal weight of the child<br/>
+
* '''weightX''' (table): the horizontal weight of the child
* '''weighty''': The vertical weight of the child<br/>
+
* '''weightY''' (table): the vertical weight of the child
* '''minWidth''': Minimum width<br/>
+
* '''minWidth''' (table): minimum width
* '''minHeight''': Minimum height<br/></translate>
+
* '''minHeight''' (table): minimum height
<source lang="lua">
+
 
(table) = Sprite:getLayoutInfo()
+
* '''reqWidth''' (number): total grid width in pixels
</source>
+
* '''reqHeight''' (number): total grid height in pixels
=== <translate>Return values</translate> ===
+
* '''cellSpacingX''' (number): cell spacing x
'''<translate>Returns</translate>''' (table) <translate>Table of layout information.</translate><br/>
+
* '''cellSpacingY''' (number): cell spacing y
 +
 
 +
=== Return values ===
 +
'''Returns''' (table) table of layout information<br/>
 +
 
 +
=== Example ===
 +
<syntaxhighlight lang="lua">
 +
local lp3 = myholder:getLayoutInfo()
 +
for k, v in pairs(lp3) do
 +
print(k, v)
 +
end
 +
print(lp3.width)
 +
</syntaxhighlight>
  
 
{{Sprite}}
 
{{Sprite}}

Latest revision as of 16:25, 20 October 2025

Available since: Gideros 2018.9
Class: Sprite

Description

Returns computed placement value according to Gideros layout system.

(table) = Sprite:getLayoutInfo()

The returned table can contain the following fields:

  • startx (number): the 0-based index of the column the child was placed into
  • starty (number): the 0-based index of the row the child was placed into
  • width (number): the width of the child (number of columns)
  • height (number): the height of the child (number of rows)
  • weightX (table): the horizontal weight of the child
  • weightY (table): the vertical weight of the child
  • minWidth (table): minimum width
  • minHeight (table): minimum height
  • reqWidth (number): total grid width in pixels
  • reqHeight (number): total grid height in pixels
  • cellSpacingX (number): cell spacing x
  • cellSpacingY (number): cell spacing y

Return values

Returns (table) table of layout information

Example

local lp3 = myholder:getLayoutInfo()
for k, v in pairs(lp3) do
	print(k, v)
end
print(lp3.width)