forked from public/foundryvtt-reve-de-dragon
Fix: tooltips sorts TMRs
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import { TMRUtility } from "../tmr-utility.js";
|
||||
import { Draconique } from "./draconique.js";
|
||||
import { PixiTMR } from "./pixi-tmr.js";
|
||||
|
||||
@ -16,7 +17,6 @@ export class CarteTmr extends Draconique {
|
||||
img() { return 'systems/foundryvtt-reve-de-dragon/styles/img/ui/tmr.webp' }
|
||||
|
||||
createSprite(pixiTMR) {
|
||||
|
||||
const img = PixiTMR.getImgFromCode(this.code())
|
||||
const sprite = new PIXI.Sprite(PIXI.utils.TextureCache[img]);
|
||||
// Setup the position of the TMR
|
||||
@ -28,10 +28,12 @@ export class CarteTmr extends Draconique {
|
||||
sprite.anchor.set(0);
|
||||
sprite.buttonMode = true;
|
||||
sprite.tmrObject = pixiTMR;
|
||||
|
||||
pixiTMR.addTooltip(sprite, (e,s) => this.computeTooltip(e,s));
|
||||
pixiTMR.pixiApp.stage.addChild(sprite);
|
||||
return sprite;
|
||||
}
|
||||
|
||||
computeTooltip(coordTMR) {
|
||||
const tmr = TMRUtility.getTMR(coordTMR)
|
||||
return tmr? TMRUtility.getTMRLabel(coordTMR) : '';
|
||||
}
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user