mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-10 18:32:16 +02:00
Increase tooltip size, reverse y when necessary, and always show passive tooltip
This commit is contained in:
parent
6d3456307a
commit
6c5079b097
@ -3134,7 +3134,7 @@ export default class StarterSelectUiHandler extends MessageUiHandler {
|
||||
this.pokemonPassiveText.setAlpha(textAlpha);
|
||||
this.pokemonPassiveText.setShadowColor(this.getTextColor(textStyle, true));
|
||||
|
||||
if (this.pokemonPassiveText.visible && isUnlocked && isEnabled) {
|
||||
if (this.pokemonPassiveText.visible) {
|
||||
this.pokemonPassiveText.on("pointerover", () => this.scene.ui.showTooltip("", `${passiveAbility.description}`, true));
|
||||
this.pokemonPassiveText.on("pointerout", () => this.scene.ui.hideTooltip());
|
||||
}
|
||||
|
12
src/ui/ui.ts
12
src/ui/ui.ts
@ -241,7 +241,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||
|
||||
this.tooltipContent = addTextObject(this.scene, 6, 16, "", TextStyle.TOOLTIP_CONTENT);
|
||||
this.tooltipContent.setName("text-tooltip-content");
|
||||
this.tooltipContent.setWordWrapWidth(696);
|
||||
this.tooltipContent.setWordWrapWidth(850);
|
||||
|
||||
this.tooltipContainer.add(this.tooltipBg);
|
||||
this.tooltipContainer.add(this.tooltipTitle);
|
||||
@ -378,7 +378,7 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||
const wrappedContent = this.tooltipContent.runWordWrap(content);
|
||||
this.tooltipContent.setText(wrappedContent);
|
||||
this.tooltipContent.y = title ? 16 : 4;
|
||||
this.tooltipBg.width = Math.min(Math.max(this.tooltipTitle.displayWidth, this.tooltipContent.displayWidth) + 12, 684);
|
||||
this.tooltipBg.width = Math.min(Math.max(this.tooltipTitle.displayWidth, this.tooltipContent.displayWidth) + 12, 838);
|
||||
this.tooltipBg.height = (title ? 31 : 19) + 10.5 * (wrappedContent.split("\n").length - 1);
|
||||
}
|
||||
|
||||
@ -389,8 +389,12 @@ export default class UI extends Phaser.GameObjects.Container {
|
||||
|
||||
update(): void {
|
||||
if (this.tooltipContainer.visible) {
|
||||
const reverse = this.scene.game.input.mousePointer && this.scene.game.input.mousePointer.x >= this.scene.game.canvas.width - this.tooltipBg.width * 6 - 12;
|
||||
this.tooltipContainer.setPosition(!reverse ? this.scene.game.input.mousePointer!.x / 6 + 2 : this.scene.game.input.mousePointer!.x / 6 - this.tooltipBg.width - 2, this.scene.game.input.mousePointer!.y / 6 + 2); // TODO: are these bangs correct?
|
||||
const xReverse = this.scene.game.input.mousePointer && this.scene.game.input.mousePointer.x >= this.scene.game.canvas.width - this.tooltipBg.width * 6 - 12;
|
||||
const yReverse = this.scene.game.input.mousePointer && this.scene.game.input.mousePointer.y >= this.scene.game.canvas.height - this.tooltipBg.height * 6 - 12;
|
||||
this.tooltipContainer.setPosition(
|
||||
!xReverse ? this.scene.game.input.mousePointer!.x / 6 + 2 : this.scene.game.input.mousePointer!.x / 6 - this.tooltipBg.width - 2,
|
||||
!yReverse ? this.scene.game.input.mousePointer!.y / 6 + 2 : this.scene.game.input.mousePointer!.y / 6 - this.tooltipBg.height - 2,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user