Larkinabout / fvtt-token-action-hud-core

Token Action HUD is a repositionable HUD of actions for a selected token.
13 stars 18 forks source link

[BUG] Changing layout #148

Closed mrcomac closed 1 year ago

mrcomac commented 1 year ago

Describe the bug I'm making the token action hud for savage wolrds and during the process to build the layout I identified when I change the layout the token action hud core doesn't update it.

For example, i've created the layout below (ignore strings hard coded I'll change to get names before release it)

async doRegisterDefaultFlags () {
            const GROUP = {
                attributes: { id: 'attributes', name: 'Attributes', type: 'system' },
                skills: { id: 'skills', name: 'Skills', type: 'system' }
            }
            const groups = GROUP
            Object.values(groups).forEach(group => {
                group.name =group.name
                group.listName = `Group: ${group.name}`
            })
            const groupsArray = Object.values(groups)
            DEFAULTS = {
                layout: [
                    {
                        nestId: 'attributes',
                        id: 'attributes',
                        name: "Attributes",
                        groups: [
                            { ...groups.attributes, nestId: 'attributes_abilities' }
                        ]
                    },
                    {
                        nestId: 'skills',
                        id: 'skills',
                        name: "Skills",
                        groups: [
                            { ...groups.skills, nestId: 'skills_abilities' }
                        ]
                    }
                ],
                groups: groupsArray
            }
            return DEFAULTS
        }

When I change the layout to the below, token hud core says Token Action HUD Debug | Hud update aborted as no character(s) found or hud is disabled however I have un update in the layout.

async doRegisterDefaultFlags () {
            const GROUP = {
                attributes: { id: 'attributes', name: 'Attributes', type: 'system' },
                skills: { id: 'skills', name: 'Skills', type: 'system' },
                powers: { id: 'powers', name: 'Powers', type: 'system' }
            }
            const groups = GROUP
            Object.values(groups).forEach(group => {
                group.name =group.name
                group.listName = `Group: ${group.name}`
            })
            const groupsArray = Object.values(groups)
            DEFAULTS = {
                layout: [
                    {
                        nestId: 'attributes',
                        id: 'attributes',
                        name: "Attributes",
                        groups: [
                            { ...groups.attributes, nestId: 'attributes_abilities' }
                        ]
                    },
                    {
                        nestId: 'skills',
                        id: 'skills',
                        name: "Skills",
                        groups: [
                            { ...groups.skills, nestId: 'skills_abilities' }
                        ]
                    },
                    {
                        nestId: 'powers',
                        id: 'powers',
                        name: "Powers",
                        groups: [
                            { ...groups.powers, nestId: 'powers_abilities' }
                        ]
                    }
                ],
                groups: groupsArray
            }
            return DEFAULTS
        }

This is causing I need to create a new world to test the new layout.

Steps to reproduce

  1. Create a world and enable token hud core and the token hud for the system
  2. change the layout and refresh the screen

Versions:

Additional context N/A

mrcomac commented 1 year ago

actually something odd happened.. I removed the new option, added again and it worked.. not sure if it was a typo.