1
0
Fork 0

character sheet: Limit width of equipment tooltip

This commit is contained in:
Michaël Lemaire 2017-05-18 11:49:49 +02:00
parent 58b3cdf5b2
commit d1fa45bf7a
2 changed files with 6 additions and 2 deletions

View file

@ -158,7 +158,7 @@ module TS.SpaceTac.UI {
*/
fillTooltip(filler: TooltipFiller): boolean {
filler.addText(0, 0, this.item.getFullName(), "#cccccc", 20, false, true);
filler.addText(0, 40, this.item.getFullDescription(), "#cccccc", 18);
filler.addText(0, 40, this.item.getFullDescription(), "#cccccc", 18, false, false, 700);
return true;
}
}

View file

@ -115,9 +115,13 @@ module TS.SpaceTac.UI {
/**
* Add a text to the content
*/
addText(x: number, y: number, content: string, color = "#ffffff", size = 16, center = false, bold = false): void {
addText(x: number, y: number, content: string, color = "#ffffff", size = 16, center = false, bold = false, width = 0): void {
let style = { font: `${bold ? "bold " : ""}${size}pt Arial`, fill: color, align: center ? "center" : "left" };
let text = new Phaser.Text(this.container.game, x, y, content, style);
if (width) {
text.wordWrap = true;
text.wordWrapWidth = width;
}
this.container.content.add(text);
}
}