Closed farling42 closed 1 year ago
The selected flag is to track actions added/removed by the user.
If I'm understanding correctly, you'll want to add the 'toggle' class to the cssClass property of the action and add 'active' class when the action is selected/toggled on.
Here's an example from the D&D 5e code:
const active = this.actors.every((actor) => {
const effects = actor.effects
return effects
.map((effect) => effect.flags?.core?.statusId)
.some((statusId) => statusId === id)
})
? ' active'
: ''
const cssClass = `toggle${active}`
Which file is the dnd5e extract from? So that I can see it in more context.
That one is from the _buildConditions
method in action-handler.js.
I'm setting the cssClass parameter to either "toggle" or "toggleactive", but that only changes the colour of the glow when I hover the mouse over the button, it doesn't show when I open the menu.
I can see it working properly in dnd5e.
'toggle' and 'active' are separate css classes, so you'll need to put a space between them.
Thanks, that is working now.
I have some entries which I want to show if they are selected or not.
What field needs adding to the action that I create?
I can see a "selected" field being set, but it doesn't change how anything is displayed in the HUD.