Phaser API Documentation

  Version: 
setWordWrapCallback(callback, [scope])

Description:

Set a custom callback for wrapping lines.

Pass in null to remove wrapping by callback.

Parameters:

name type arguments Default description
callback TextStyleWordWrapCallback

A custom function that will be responsible for wrapping the text. It will receive two arguments: text (the string to wrap), textObject (this Text instance). It should return the wrapped lines either as an array of lines or as a string with newline characters in place to indicate where breaks should happen.

scope object <optional> null

The scope that will be applied when the callback is invoked.

Returns:
Description:

The parent Text object.

Since: 3.0.0