Class: ScaleContainer

ScaleContainer

ScaleContainer

new GOWN.ScaleContainer(texture, rect, middleWidth, centerHeight)

Scale 9 Container. e.g. useful for scalable buttons.
Name Type Description
texture PIXI.Texture The PIXI texture
rect PIXI.Rectangle The rectangle with position and dimensions of the center piece. Will be used to calculate positions of all other pieces
middleWidth Number optional The alternative width to crop the center piece (only needed if we want to scale the image smaller than the original)
centerHeight Number optional The alternative height to crop the center piece (only needed if we want to scale the image smaller than the original)

Extends

  • PIXI.Container

Members

baseTexturePIXI.BaseTexture

The base texture of the scale container

blPIXI.Sprite

The bottom left sprite

bmPIXI.Sprite

The bottom middle sprite

brPIXI.Sprite

The bottom right sprite

clPIXI.Sprite

The center left sprite

cmPIXI.Sprite

The center middle sprite

crPIXI.Sprite

The center right sprite

framePIXI.Rectangle

The frame of the scale container

heightNumber

The height of the container. Setting this will redraw the component.

minHeightNumber

Calculated min. height based on tile sizes in pixel without scaling (if middleWidth is not set it is the same as the height of the texture in the atlas)

minWidthNumber

Calculated min. width based on tile sizes in pixel without scaling (if middleWidth is not set it is the same as the width of the texture in the atlas)

rectPIXI.Rectangle

The rectangle with position and dimensions of the center piece. Will be used to calculate positions of all other pieces.

tlPIXI.Sprite

The top left sprite

tmPIXI.Sprite

The top middle sprite

trPIXI.Sprite

The top right sprite

widthNumber

The width of the container. Setting this will redraw the component.

Methods

staticGOWN.ScaleContainer.fromFrame(frameId, rect){GOWN.ScaleContainer}

Helper function that creates a sprite that will contain a texture from the TextureCache based on the frameId. The frame ids are created when a Texture packer file has been loaded
Name Type Description
frameId String The frame id of the texture in the cache
rect Rectangle Defines the tilable area
Returns:
Type Description
GOWN.ScaleContainer A new scalable container (e.g. a button) using a texture from the texture cache matching the frameId