Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 1.02 KB

File metadata and controls

32 lines (26 loc) · 1.02 KB

Get Centered Dimension (X or Y for Self)

Table of Contents

Need to center a control in relation to its parent dimension? Use this formula to get the X or Y value for the control.

    //
    // Get the X or the Y of a control in relation to
    // its parent dimension.
    //
    // Understanding the parameters:
    //   - Pass in width values to get the X value for 'Self'
    //   - Pass in height values to get the Y value for 'Self'
    //
    fxGetCenteredDimension( ParentDimension:Number,
                            SelfDimension:Number):Number = (
        (ParentDimension - SelfDimension) / 2
    );

    // You could simply copy/paste this for X value for centered self
    // #️⃣ fxGetCenteredDimension(Parent.Width, Self.Width)
    // You could simply copy/paste this for Y value for centered self
    // #️⃣ fxGetCenteredDimension(Parent.Height, Self.Height)

History

Date Author Changes
2026-01-27 Migration Initial TOC and history section added