Merge pull request #5194 from mikewesthad/types-fix-wordwrap

Update TextStyle to have jsdocs for word wrap related properties
This commit is contained in:
Richard Davey 2020-07-13 12:57:29 +01:00 committed by GitHub
commit be158f48e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -294,6 +294,58 @@ var TextStyle = new Class({
*/
this.baselineY;
/**
* The maximum width of a line of text in pixels. Null means no line wrapping. Setting this
* property directly will not re-run the word wrapping algorithm. To change the width and
* re-wrap, use {@link Phaser.GameObjects.TextStyle#setWordWrapWidth}.
*
* @name Phaser.GameObjects.TextStyle#wordWrapWidth
* @type {number | null}
* @default null
* @since 3.23.0
*/
this.wordWrapWidth;
/**
* 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. Setting this directly will not re-run the
* word wrapping algorithm. To change the callback and re-wrap, use
* {@link Phaser.GameObjects.TextStyle#setWordWrapCallback}.
*
* @name Phaser.GameObjects.TextStyle#wordWrapCallback
* @type {TextStyleWordWrapCallback | null}
* @default null
* @since 3.23.0
*/
this.wordWrapCallback;
/**
* The scope that will be applied when the wordWrapCallback is invoked. Setting this directly will not re-run the
* word wrapping algorithm. To change the callback and re-wrap, use
* {@link Phaser.GameObjects.TextStyle#setWordWrapCallback}.
*
* @name Phaser.GameObjects.TextStyle#wordWrapCallbackScope
* @type {object | null}
* @default null
* @since 3.23.0
*/
this.wordWrapCallbackScope;
/**
* Whether or not to use the advanced wrapping algorithm. If true, spaces are collapsed and
* whitespace is trimmed from lines. If false, spaces and whitespace are left as is. Setting
* this property directly will not re-run the word wrapping algorithm. To change the
* advanced setting and re-wrap, use {@link Phaser.GameObjects.TextStyle#setWordWrapWidth}.
*
* @name Phaser.GameObjects.TextStyle#wordWrapUseAdvanced
* @type {boolean}
* @default false
* @since 3.23.0
*/
this.wordWrapUseAdvanced;
/**
* The font style, size and family.
*