PIXI.NineSlicePlane

class NineSlicePlane extends PIXI.SimplePlane

The NineSlicePlane allows you to stretch a texture using 9-slice scaling. The corners will remain unscaled (useful for buttons with rounded corners for example) and the other areas will be scaled horizontally and or vertically

 let Plane9 = new PIXI.NineSlicePlane(PIXI.Texture.from('BoxWithRoundedCorners.png'), 15, 15, 15, 15);
      A                          B
    +---+----------------------+---+
  C | 1 |          2           | 3 |
    +---+----------------------+---+
    |   |                      |   |
    | 4 |          5           | 6 |
    |   |                      |   |
    +---+----------------------+---+
  D | 7 |          8           | 9 |
    +---+----------------------+---+
  When changing this objects width and/or height:
     areas 1 3 7 and 9 will remain unscaled.
     areas 2 and 8 will be stretched horizontally
     areas 4 and 6 will be stretched vertically
     area 5 will be stretched both horizontally and vertically
 

Constructor


new PIXI.NineSlicePlane(texture: PIXI.Texture, leftWidth: number, topHeight: number, rightWidth: number, bottomHeight: number) → {}
Parameters:
Name Type Attributes Default Description
texture PIXI.Texture

The texture to use on the NineSlicePlane.

leftWidth number

<optional>

10

size of the left vertical bar (A)

topHeight number

<optional>

10

size of the top horizontal bar (C)

rightWidth number

<optional>

10

size of the right vertical bar (B)

bottomHeight number

<optional>

10

size of the bottom horizontal bar (D)

Summary


Properties from NineSlicePlane

_height

The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

_width

The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

number
bottomHeight

The height of the bottom row.

number
height

The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

number
leftWidth

The width of the left column.

number
rightWidth

The width of the right column.

number
topHeight

The height of the top row.

number
width

The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

number
protected _cachedTint = 16777215
HTMLCanvasElement
protected _tintedCanvas = undefined

Methods from NineSlicePlane

void
updateHorizontalVertices()

Updates the horizontal vertices.

void
updateVerticalVertices()

Updates the vertical vertices.

Properties inherited from SimplePlane

boolean
autoResize

The geometry is automatically updated when the texture size changes.

Properties inherited from Mesh

Properties inherited from Container

T[]
children
boolean
interactiveChildren = true
boolean
sortableChildren
boolean
sortDirty

Should children be sorted by zIndex at the next updateTransform call.

Properties inherited from DisplayObject

boolean
_accessibleActive = false
boolean
_accessibleDiv = undefined
PIXI.Bounds
_bounds

The bounds object, this is used to calculate and store the bounds of the displayObject.

PIXI.Bounds
_localBounds

Local bounds object, swapped with _bounds when using getLocalBounds().

boolean
accessible = false
boolean
accessibleChildren = true
string
accessibleHint = undefined
string
accessiblePointerEvents = 'auto'
?string
accessibleTitle = undefined
string
accessibleType = 'button'
number
alpha

The opacity of the object.

number
angle
boolean
buttonMode
boolean
cacheAsBitmap
number
cacheAsBitmapMultisample = PIXI.MSAA_QUALITY.NONE
number
cacheAsBitmapResolution = null
boolean
cullable

Should this object be rendered if the bounds of this object are out of frame?

PIXI.Rectangle
cullArea
string
cursor = undefined
boolean
destroyed

Readonly flag for destroyed display objects.

PIXI.Rectangle
filterArea
PIXI.Filter[] | null
filters
PIXI.IHitArea
hitArea = undefined
boolean
interactive = false
boolean
isMask

Does any other displayObject use this object as a mask?

boolean
isSprite

Used to fast check if a sprite is.. a sprite!

PIXI.Matrix
localTransform
PIXI.Container | PIXI.MaskData | null
mask
string
name = undefined
PIXI.Container
parent

The display object container that contains this display object.

PIXI.ObservablePoint
pivot
PIXI.ObservablePoint
position
boolean
renderable
number
rotation
PIXI.ObservablePoint
scale

The scale factors of this object along the local coordinate axes.

PIXI.ObservablePoint
skew
PIXI.DisplayObject
smartMask = undefined
PIXI.Transform
transform
boolean
visible
number
worldAlpha
PIXI.Matrix
worldTransform
boolean
worldVisible
number
x
number
y
number
zIndex

The zIndex of the displayObject.

number
protected _boundsID

Flags the cached bounds as dirty.

PIXI.Rectangle
protected _boundsRect

Cache of this display-object's bounds-rectangle.

boolean
protected _destroyed

If the object has been destroyed via destroy(). If true, it should not be used.

PIXI.Filter[]
protected _enabledFilters
number
protected _lastSortedIndex
PIXI.Rectangle
protected _localBoundsRect

Cache of this display-object's local-bounds rectangle.

PIXI.Container | PIXI.MaskData
protected _mask
PIXI.Container
protected _tempDisplayObjectParent
number
protected _zIndex

Methods inherited from SimplePlane

Methods inherited from Mesh

void
calculateUvs()

Updates uv field based on from geometry uv's or batchUvs.

void
calculateVertices()

Updates vertexData field based on transform and vertices.

boolean
containsPoint(point: IPointData)
void
protected _calculateBounds()
void
protected _render(renderer: PIXI.Renderer)
void
protected _renderDefault(renderer: PIXI.Renderer)
void
protected _renderToBatch(renderer: PIXI.Renderer)

Methods inherited from Container

PIXI.DisplayObject
addChild(children: PIXI.DisplayObject)

Adds one or more children to the container.

PIXI.DisplayObject
addChildAt(child: PIXI.DisplayObject, index: number)
void
calculateBounds()

Recalculates the bounds of the container.

containerUpdateTransform()
void
destroy(options: IDestroyOptions | boolean)
T
getChildAt(index: number)
PIXI.DisplayObject
getChildByName(name: string, deep: boolean)

Returns the display object in the container.

number
getChildIndex(child: T)
PIXI.Rectangle
getLocalBounds(rect: PIXI.Rectangle, skipChildrenUpdate: boolean)

Retrieves the local bounds of the displayObject as a rectangle object.

PIXI.DisplayObject
removeChild(children: PIXI.DisplayObject)
T
removeChildAt(index: number)
T[]
removeChildren(beginIndex: number, endIndex)
void
render(renderer: PIXI.Renderer)

Renders the object using the WebGL renderer.

void
renderCanvas(renderer: PIXI.CanvasRenderer)
void
setChildIndex(child: T, index: number)
void
sortChildren()

Sorts children by zIndex. Previous order is maintained for 2 children with the same zIndex.

void
swapChildren(child: T, child2: T)
void
updateTransform()

Updates the transform on all children of this container for rendering.

void
protected _renderWithCulling(renderer: PIXI.Renderer)
void
protected onChildrenChange(_length: number)
void
protected renderAdvanced(renderer: PIXI.Renderer)

Inherited Events from Container

Inherited Events from DisplayObject

added
childRemoved
click
clickcapture

Capture phase equivalent of click.

destroyed
mousedown
mousedowncapture

Capture phase equivalent of mousedown.

mouseenter

Fired when the mouse pointer is moved over a DisplayObject and its descendant's hit testing boundaries.

mouseentercapture

Capture phase equivalent of mouseenter

mouseleave

Fired when the mouse pointer exits a DisplayObject and its descendants.

mouseleavecapture

Capture phase equivalent of mouseleave.

mousemove
mousemovecature

Capture phase equivalent of mousemove.

mouseout
mouseoutcapture

Capture phase equivalent of mouseout.

mouseover
mouseovercapture

Capture phase equivalent of mouseover.

mouseup
mouseupcature

Capture phase equivalent of mouseup.

mouseupoutside
mouseupoutsidecapture

Capture phase equivalent of mouseupoutside.

pointercancel
pointercancelcapture

Capture phase equivalent of pointercancel.

pointerdown
pointerdowncapture

Capture phase equivalent of pointerdown.

pointerenter

Fired when the pointer is moved over a DisplayObject and its descendant's hit testing boundaries.

pointerentercapture

Capture phase equivalent of pointerenter

pointerleave

Fired when the pointer leaves the hit testing boundaries of a DisplayObject and its descendants.

pointerleavecapture

Capture phase equivalent of pointerleave.

pointermove
pointermovecapture

Capture phase equivalent of pointermove.

pointerout
pointeroutcapture

Capture phase equivalent of pointerout.

pointerover
pointerovercapture

Capture phase equivalent of pointerover.

pointertap
pointertapcapture

Capture phase equivalent of pointertap.

pointerup
pointerupcapture

Capture phase equivalent of pointerup.

pointerupoutside
pointerupoutsidecapture

Capture phase equivalent of pointerupoutside.

removed
rightclick
rightclickcapture

Capture phase equivalent of rightclick.

rightdown
rightdowncapture

Capture phase equivalent of rightdown.

rightup
rightupcapture

Capture phase equivalent of rightup.

rightupoutside
rightupoutsidecapture

Capture phase equivalent of rightupoutside.

tap
tapcapture

Capture phase equivalent of tap.

touchcancel
touchcancelcapture

Capture phase equivalent of touchcancel.

touchend
touchendcapture

Capture phase equivalent of touchend.

touchendoutside
touchendoutsidecapture

Capture phase equivalent of touchendoutside.

touchmove
touchmovecapture

Capture phase equivalent of touchmove.

touchstart
touchstartcapture

Capture phase equivalent of touchstart.

PIXI.FederatedWheelEvent
wheel

Fired when a the user scrolls with the mouse cursor over a DisplayObject.

PIXI.FederatedWheelEvent
wheelcapture

Capture phase equivalent of wheel.

Public Properties


_height NineSlicePlane.ts:89
_height

The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

_width NineSlicePlane.ts:86
_width

The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

bottomHeight NineSlicePlane.ts:218
bottomHeight: number

The height of the bottom row.

height NineSlicePlane.ts:170
height: number

The height of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

leftWidth NineSlicePlane.ts:182
leftWidth: number

The width of the left column.

rightWidth NineSlicePlane.ts:194
rightWidth: number

The width of the right column.

topHeight NineSlicePlane.ts:206
topHeight: number

The height of the top row.

width NineSlicePlane.ts:158
width: number

The width of the NineSlicePlane, setting this will actually modify the vertices and UV's of this plane.

Protected Properties


_cachedTint NineSlicePlane.ts:6
protected _cachedTint: number = 16777215

Cached tint value so we can tell when the tint is changed.

_tintedCanvas NineSlicePlane.ts:14
protected _tintedCanvas: HTMLCanvasElement = undefined

Cached tinted texture.

Public Methods


updateHorizontalVertices NineSlicePlane.ts:117
updateHorizontalVertices() → {void}

Updates the horizontal vertices.

Returns:
Type Description
void
updateVerticalVertices NineSlicePlane.ts:129
updateVerticalVertices() → {void}

Updates the vertical vertices.

Returns:
Type Description
void

Powered by webdoc!