diff --git a/changelog.md b/changelog.md index a4044cd3..d11df50d 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,9 @@ # Changelog +## [0.9.17] 2020-11-23 +### Changed/added +- Added option to keep categories open (if click-to-open is enabled) when an action is pressed, so categories don't have to be constantly reopened + ## [0.9.16] 2020-11-21 ### Bugfix - DND Check for null combat diff --git a/lang/en.json b/lang/en.json index 2c54d554..fbe7c3a6 100644 --- a/lang/en.json +++ b/lang/en.json @@ -156,6 +156,8 @@ "tokenactionhud.settings.showIcons.hint": "If enabled, the action image will be displayed on the HUD button where available.", "tokenactionhud.settings.clickOpenCategory.name": "Click-to-open categories", "tokenactionhud.settings.clickOpenCategory.hint": "If enabled, categories will open on click instead of hover.", + "tokenactionhud.settings.clickCloseCategory.name": "Close categories on action", + "tokenactionhud.settings.clickCloseCategory.hint": "If enabled, categories will close when an action is chosen. Has no effect is click-to-open (above) is disabled.", "tokenactionhud.settings.dnd5e.ignorePassiveFeats.name": "Ignore passive feats", "tokenactionhud.settings.dnd5e.ignorePassiveFeats.hint": "If enabled, passive feats are not shown.", diff --git a/module.json b/module.json index 8b567358..47939cb1 100644 --- a/module.json +++ b/module.json @@ -1 +1,75 @@ -{"name":"token-action-hud","title":"Token Action HUD","author":"^ and stick#0520","description":"Creates a HUD showing a selected token's common actions.","minimumCoreVersion":"0.6.0","compatibleCoreVersion":"0.7.6","scripts":["./lib/tagify/tagify.min.js"],"esmodules":["./scripts/init.js"],"styles":["./styles/token-action-hud.css","/styles/lib/tagify/tagify.css"],"systems":["dnd5e","dungeonworld","pf2e","wfrp4e","sfrpg","sw5e","demonlord","pf1","lancer"],"languages":[{"lang":"en","name":"English","path":"lang/en.json"},{"lang":"ko","name":"Korean","path":"lang/ko.json"},{"lang":"pt-br","name":"Brazilian Portuguese","path":"lang/br.json"},{"lang":"es","name":"Spanish","path":"lang/es.json"},{"lang":"fr","name":"French","path":"lang/fr.json"},{"lang":"pl","name":"Polish","path":"lang/pl.json"},{"lang":"ja","name":"日本語","path":"lang/ja.json"},{"lang":"cn","name":"中文","path":"lang/cn.json"}],"url":"https://github.com/espositos/fvtt-tokenactionhud","manifest":"https://github.com/espositos/fvtt-tokenactionhud/raw/master/module.json","version":"0.9.16","download":"https://github.com/espositos/fvtt-tokenactionhud/releases/download/0.9.16/release_0.9.16.zip"} \ No newline at end of file +{ + "name": "token-action-hud", + "title": "Token Action HUD", + "author": "^ and stick#0520", + "description": "Creates a HUD showing a selected token's common actions.", + "minimumCoreVersion": "0.6.0", + "compatibleCoreVersion": "0.7.7", + "scripts": [ + "./lib/tagify/tagify.min.js" + ], + "esmodules": [ + "./scripts/init.js" + ], + "styles": [ + "./styles/token-action-hud.css", + "/styles/lib/tagify/tagify.css" + ], + "systems": [ + "dnd5e", + "dungeonworld", + "pf2e", + "wfrp4e", + "sfrpg", + "sw5e", + "demonlord", + "pf1", + "lancer" + ], + "languages": [ + { + "lang": "en", + "name": "English", + "path": "lang/en.json" + }, + { + "lang": "ko", + "name": "Korean", + "path": "lang/ko.json" + }, + { + "lang": "pt-br", + "name": "Brazilian Portuguese", + "path": "lang/br.json" + }, + { + "lang": "es", + "name": "Spanish", + "path": "lang/es.json" + }, + { + "lang": "fr", + "name": "French", + "path": "lang/fr.json" + }, + { + "lang": "pl", + "name": "Polish", + "path": "lang/pl.json" + }, + { + "lang": "ja", + "name": "日本語", + "path": "lang/ja.json" + }, + { + "lang": "cn", + "name": "中文", + "path": "lang/cn.json" + } + ], + "url": "https://github.com/espositos/fvtt-tokenactionhud", + "manifest": "https://github.com/espositos/fvtt-tokenactionhud/raw/master/module.json", + "version": "0.9.16", + "download": "https://github.com/espositos/fvtt-tokenactionhud/releases/download/0.9.16/release_0.9.16.zip" +} \ No newline at end of file diff --git a/scripts/settings.js b/scripts/settings.js index 5ba12f60..96d1749a 100644 --- a/scripts/settings.js +++ b/scripts/settings.js @@ -87,6 +87,16 @@ export const registerSettings = function(app, systemManager, rollHandlers) { default : false, onChange: value => { updateFunc(value); } }); + + game.settings.register(appName,'clickCloseCategory', { + name : game.i18n.localize('tokenactionhud.settings.clickCloseCategory.name'), + hint : game.i18n.localize('tokenactionhud.settings.clickCloseCategory.hint'), + scope : 'client', + config : true, + type : Boolean, + default : false, + onChange: value => { updateFunc(value); } + }); systemManager.doRegisterSettings(appName, updateFunc); diff --git a/scripts/tokenactionhud.js b/scripts/tokenactionhud.js index ac36230a..15c1de0c 100644 --- a/scripts/tokenactionhud.js +++ b/scripts/tokenactionhud.js @@ -76,6 +76,9 @@ export class TokenActionHUD extends Application { const action = '.tah-action'; const handleClick = e => { + if (settings.get('clickOpenCategory') && !settings.get('clickCloseCategory')) + e.stopPropagation(); + let target = e.target; if (target.tagName !== 'BUTTON') @@ -149,13 +152,13 @@ export class TokenActionHUD extends Application { let category = $(this)[0]; let boundClick; - if (!$(category).hasClass('hover')) { - boundClick = openCategory.bind(this); - boundClick = boundClick(event); - } - else { + if ($(category).hasClass('hover')) { boundClick = closeCategory.bind(this); boundClick(event); + } + else { + boundClick = openCategory.bind(this); + boundClick(event); } }