mirror of
https://github.com/photonstorm/phaser
synced 2025-02-16 22:18:29 +00:00
Text.setStyle has a new argument update
which will optionally automatically call updateText
after setting the new style (thanks @staff0rd #2478)
This commit is contained in:
parent
f34b567295
commit
4fd2524c61
3 changed files with 12 additions and 3 deletions
|
@ -351,6 +351,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
|
|||
* The Arcade Physics overlap method would return false if two bodies were overlapping but neither had any velocity (i.e. they were embedded into each other)
|
||||
* PIXI.defaultRenderer is now set to `null` in Game.destroy, allowing it to be reset if a new Game instance is created on the same page (thanks @xtforgame ##2474)
|
||||
* BitmapData.drawGroupProxy is now capable of iterating through Sprites that have children, and also now uses the world positions for drawing instead. This change updates the functionality of BitmapData.drawGroup.
|
||||
* Text.setStyle has a new argument `update` which will optionally automatically call `updateText` after setting the new style (thanks @staff0rd #2478)
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
|
|
@ -287,9 +287,12 @@ Phaser.Text.prototype.setShadow = function (x, y, color, blur, shadowStroke, sha
|
|||
* @param {number} [style.wordWrapWidth=100] - The width in pixels at which text will wrap.
|
||||
* @param {number} [style.maxLines=0] - The maximum number of lines to be shown for wrapped text.
|
||||
* @param {number|array} [style.tabs=0] - The size (in pixels) of the tabs, for when text includes tab characters. 0 disables. Can be an array of varying tab sizes, one per tab stop.
|
||||
* @param {boolean} [update=false] - Immediately update the Text object after setting the new style? Or wait for the next frame.
|
||||
* @return {Phaser.Text} This Text instance.
|
||||
*/
|
||||
Phaser.Text.prototype.setStyle = function (style) {
|
||||
Phaser.Text.prototype.setStyle = function (style, update) {
|
||||
|
||||
if (update === undefined) { update = false; }
|
||||
|
||||
style = style || {};
|
||||
style.font = style.font || 'bold 20pt Arial';
|
||||
|
@ -343,6 +346,11 @@ Phaser.Text.prototype.setStyle = function (style) {
|
|||
this.style = style;
|
||||
this.dirty = true;
|
||||
|
||||
if (update)
|
||||
{
|
||||
this.updateText();
|
||||
}
|
||||
|
||||
return this;
|
||||
|
||||
};
|
||||
|
|
4
typescript/phaser.d.ts
vendored
4
typescript/phaser.d.ts
vendored
|
@ -1,7 +1,7 @@
|
|||
/// <reference path="pixi.d.ts" />
|
||||
/// <reference path="p2.d.ts" />
|
||||
|
||||
// Type definitions for Phaser 2.4.8 - 29th April 2016
|
||||
// Type definitions for Phaser 2.4.8 - 16th May 2016
|
||||
// Project: https://github.com/photonstorm/phaser
|
||||
|
||||
declare module "phaser" {
|
||||
|
@ -4827,7 +4827,7 @@ declare module Phaser {
|
|||
preUpdate(): void;
|
||||
renderTabLine(line: string, x: number, y: number, fill?: boolean): void;
|
||||
setShadow(x?: number, y?: number, color?: any, blur?: number, shadowStroke?: boolean, shadowFill?: boolean): Phaser.Text;
|
||||
setStyle(style?: PhaserTextStyle): Phaser.Text;
|
||||
setStyle(style?: PhaserTextStyle, update?: boolean): Phaser.Text;
|
||||
setText(text: string): Phaser.Text;
|
||||
setTextBounds(x?: number, y?: number, width?: number, height?: number): Phaser.Text;
|
||||
update(): void;
|
||||
|
|
Loading…
Add table
Reference in a new issue