Class PixelLayout

  • All Implemented Interfaces:
    kotlin.Cloneable

    
    public class PixelLayout
    extends Layout
                        

    The most basic layout.

    Just a container basically, that can infer it's size.

    • Method Detail

      • calculateBounds

         Unit calculateBounds()

        Calculate the position and size of this drawable. Make sure to call doDynamicSize in this method to avoid issues with sizing.

        This method is called once the layout is populated for children and component, and when a recalculation is requested.

        The value of layout's bounds will be updated after this method is called, so do not use layout's bounds as an updated value in this method.

      • onInitComplete

         Unit onInitComplete()

        This function is called when initialization of a drawable is complete, so it has been fully calculated.

        This function is called once, and only once.

        Since:

        0.19.0

      • calculateSize

         Vec2<Unit> calculateSize()

        Implement this function to return the size of this drawable, if no size is specified during construction.

        This should be so that if the drawable can determine its own size (for example, it is an image), then the size parameter in the constructor can be omitted using:

        size: Vec2<org.polyfrost.polyui.unit.Unit>? = null; and this method needs to be implemented!

        Otherwise, the size parameter in the constructor must be specified.