Fix: button text align
This commit is contained in:
@@ -123,6 +123,7 @@ class RoundRectButton {
|
||||
let width = this.setting.width - this.setting.strokeWidth * 2;
|
||||
let height = this.setting.height - this.setting.strokeWidth * 2;
|
||||
let innerRoundAmount = this.setting.roundAmount * (width / this.setting.width);
|
||||
|
||||
let btnTexture = new Phaser.Graphics()
|
||||
.beginFill(0xffffff)
|
||||
.drawRoundedRect(this.setting.strokeWidth, this.setting.strokeWidth, width, height, innerRoundAmount)
|
||||
@@ -133,8 +134,11 @@ class RoundRectButton {
|
||||
}
|
||||
|
||||
makeText(textContent) {
|
||||
let width = this.setting.width - this.setting.strokeWidth * 2;
|
||||
let height = this.setting.height - this.setting.strokeWidth * 2;
|
||||
|
||||
let btnText = game.add.text(0, 0, textContent, this.setting.fontStyle)
|
||||
.setTextBounds(0, 0, this.setting.width, this.setting.height);
|
||||
.setTextBounds(0, 0, width, this.setting.height);
|
||||
|
||||
btnText.lineSpacing = RoundRectButtonSetting.DEFAULT_TEXT_LINE_SPACING_PX;
|
||||
// btnText.anchor.setTo(0.5);
|
||||
|
||||
Reference in New Issue
Block a user