Package | ardisia.layouts |
Class | public class PackedLayout |
Inheritance | PackedLayout spark.layouts.supportClasses.LayoutBase |
View the technical documentation on the Ardisia Labs website for more information.
Property | Defined By | ||
---|---|---|---|
layoutMode : String
Layout modes available. | PackedLayout | ||
layoutRects : Vector.<Rectangle>
Vector of all the layout rectangles for the layout elements. | PackedLayout | ||
noiseFactor : Number
A random noise to add to the normal distribution, from 0 to 1. | PackedLayout | ||
peak : Number
The location of the peak of the distribution function, from 0 to 1. | PackedLayout | ||
resolution : int
The maximum number of passes allowed to minimize renderer overlap. | PackedLayout |
Method | Defined By | ||
---|---|---|---|
PackedLayout | |||
refreshPositions():void
Call to refresh the positions of the layout elements. | PackedLayout |
Method | Defined By | ||
---|---|---|---|
getNormalizedPosition(weight:Number):Number
Return the position along the distribution function. | PackedLayout | ||
getOverlap(proposedX:Number, proposedY:Number, proposedWidth:Number, proposedHeight:Number, width:Number, height:Number):Number
Returns the maximum overlap (area) that the passed proposed layout has
with the other elements
| PackedLayout | ||
getPosition(rect:Rectangle, width:Number, height:Number, normalizedWeight:Number):Rectangle
Returns a position within the bounding box based on the layoutMode. | PackedLayout |
layoutMode | property |
layoutMode:String
Layout modes available.
Random will simply place elements at random with minimized overlap.
Radial will position the elements radially around the center with minimized overlap in a more uniform way than the "weightedRadial" mode.
The weighted modes will use a distribution function tending to the quadrant defined in the mode with minimized overlap. The weight of elements corresponds to their dimensions.
The default value is "random"
.
public function get layoutMode():String
public function set layoutMode(value:String):void
layoutRects | property |
public var layoutRects:Vector.<Rectangle>
Vector of all the layout rectangles for the layout elements.
The x and y property of each Rectangle is the percentage of the total width and height respectively. The index of each Rectangle is the same as the index of the corresponding layout element on the display list.
noiseFactor | property |
noiseFactor:Number
A random noise to add to the normal distribution, from 0 to 1.
The default value is 0.25
.
public function get noiseFactor():Number
public function set noiseFactor(value:Number):void
peak | property |
peak:Number
The location of the peak of the distribution function, from 0 to 1.
The default value is 0.35
.
public function get peak():Number
public function set peak(value:Number):void
resolution | property |
resolution:int
The maximum number of passes allowed to minimize renderer overlap. Higher numbers will reduce potential renderer overlapping, but processing will take longer.
Each pass is pure arithmetic so each pass is very fast.
The default value is 100
.
public function get resolution():int
public function set resolution(value:int):void
PackedLayout | () | Constructor |
public function PackedLayout()
getNormalizedPosition | () | method |
protected function getNormalizedPosition(weight:Number):Number
Return the position along the distribution function.
Parameters
weight:Number — Number
|
Number — Number
|
getOverlap | () | method |
protected function getOverlap(proposedX:Number, proposedY:Number, proposedWidth:Number, proposedHeight:Number, width:Number, height:Number):Number
Returns the maximum overlap (area) that the passed proposed layout has with the other elements
Parameters
proposedX:Number — the x position to check overlap
| |
proposedY:Number — the y position to check overlap
| |
proposedWidth:Number — the element width to check overlap
| |
proposedHeight:Number — the element height to check overlap
| |
width:Number — the Number width of the bounding box
| |
height:Number — the Number height of the bounding box
|
Number — Number of the overlap area
|
getPosition | () | method |
protected function getPosition(rect:Rectangle, width:Number, height:Number, normalizedWeight:Number):Rectangle
Returns a position within the bounding box based on the layoutMode. Overlap with other layout elements is minimized.
Parameters
rect:Rectangle — the Rectangle to position
| |
width:Number — the Number width of the bounding box
| |
height:Number — the Number height of the bounding box
| |
normalizedWeight:Number (default = NaN ) — the normalizedWeight
|
Rectangle — Rectangle (percentX, percentY, elementWidth, elementHeight)
|
refreshPositions | () | method |
public function refreshPositions():void
Call to refresh the positions of the layout elements.