Skip to content

Commit

Permalink
Drental#308, Direction
Browse files Browse the repository at this point in the history
 - Drental#308: Fix menu closing when cursor hits gap in HUD.
 - Direction: Replace 'Dropdown' setting with 'Direction' setting to
   support left and right directions in the future.
  • Loading branch information
Larkinabout committed Oct 14, 2022
1 parent 2a5b1b3 commit beb84b1
Show file tree
Hide file tree
Showing 17 changed files with 184 additions and 100 deletions.
10 changes: 7 additions & 3 deletions lang/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@
"hint": "Ativar registro de depuração.",
"name": "Ativar depuração"
},
"dropdown": {
"hint": "Define as categorias como suspensas, caso contrário, usa uma implementação suspensa incompleta (alerta!). Sinta-se à vontade para relatar quaisquer bugs.",
"name": "Categorias suspensas"
"direction": {
"hint": "Defina a direção de expansão do HUD",
"name": "Direção",
"choices": {
"down": "Baixa",
"up": "Acima"
}
},
"enabledForUser": {
"hint": "O HUD fica ativo para o usuário. Não substitui a configuração de permissão do jogador.",
Expand Down
52 changes: 30 additions & 22 deletions lang/cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,34 @@
"utility": "实用项",
"weapons": "武器",
"settings": {
"rollHandler": {
"name": "HUD掷骰处理器",
"hint": "选择用哪个模组来接手HUD进行的动作。"
"alwaysShowAdditionalCategories": {
"name": "始终显示自定义分类",
"hint": "启用后,自定义分类在没有选择指示物时也会显示出来。"
},
"alwaysShowHud": {
"name": "始终显示HUD",
"hint": "如果用户有关联的角色,HUD会在没有选择指示物时默认显示出来该角色的动作。"
},
"clickOpenCategory": {
"name": "点击打开分类",
"hint": "启用后,需要点击而非悬浮来展开分类。"
},
"debug": {
"name": "启用调试模式",
"hint": "启用调试日志记录。(这个功能做一半跑路了,别想着会很有用)。"
},
"direction": {
"hint": "設置 HUD 展開的方向",
"name": "方向",
"choices": {
"down": "",
"up": "向上"
}
},
"enabledForUser": {
"name": "为当前用户启用HUD",
"hint": "启用后,当前用户HUD激活。不会覆盖玩家的权限设置。"
},
},
"onTokenHover": {
"name": "启用鼠标悬浮",
"hint": "启用后,鼠标悬停在受控指示物上时会显示HUD。\n警告:由于指示物在画布上的位置无法预测,某些动作的位置可能超出屏幕范围。"
Expand All @@ -113,37 +133,25 @@
"name": "为玩家启用HUD",
"hint": "启用后,玩家可以使用HUD。"
},
"debug": {
"name": "启用调试模式",
"hint": "启用调试日志记录。(这个功能做一半跑路了,别想着会很有用)。"
},
"renderItemOnRightClick": {
"name": "右键单击展示物品卡片。",
"hint": "启用后,在HUD上右键单击物品会打开该物品的物品卡片(可能与其他使用右键单击的设置冲突)。"
},
"alwaysShowHud": {
"name": "始终显示HUD",
"hint": "如果用户有关联的角色,HUD会在没有选择指示物时默认显示出来该角色的动作"
"rollHandler": {
"name": "HUD掷骰处理器",
"hint": "选择用哪个模组来接手HUD进行的动作"
},
"showHudTitle": {
"name": "显示HUD标题",
"hint": "在HUD上显示标题,通常是受控指示物的别名。"
},
"style": {
"hint": "設置 HUD 的樣式",
"name": "風格"
},
"alwaysShowAdditionalCategories": {
"name": "始终显示自定义分类",
"hint": "启用后,自定义分类在没有选择指示物时也会显示出来。"
},
"showIcons": {
"name": "显示动作图标",
"hint": "启用后,HUD的动作按钮上在可用时就会显示该动作的图像。"
},
"clickOpenCategory": {
"name": "点击打开分类",
"hint": "启用后,需要点击而非悬浮来展开分类。"
"style": {
"hint": "設置 HUD 的樣式",
"name": "風格"
}
},
"alienRpg": {
Expand Down
10 changes: 7 additions & 3 deletions lang/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@
"hint": "Enable debug logging. (This has sort of fallen by the wayside, don't expect it to be very useful)",
"name": "Enable Debugging"
},
"dropdown": {
"hint": "If enabled, sets categories to drop down, otherwise uses a (warning!) half-assed drop-up implementation. Feel free to report any bugs.",
"name": "Dropdown Categories"
"direction": {
"hint": "Legen Sie die Richtung fest, in die das HUD erweitert wird",
"name": "Richtung",
"choices": {
"down": "Runter",
"up": "Hoch"
}
},
"enabledForUser": {
"hint": "If enabled, the HUD is active for the user. Does not override the player permission setting.",
Expand Down
10 changes: 7 additions & 3 deletions lang/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@
"hint": "Enable debug logging. (This has sort of fallen by the wayside, don't expect it to be very useful)",
"name": "Enable Debugging"
},
"dropdown": {
"hint": "If enabled, sets categories to drop down, otherwise uses a (warning!) half-assed drop-up implementation. Feel free to report any bugs.",
"name": "Dropdown Categories"
"direction": {
"hint": "Set the direction the HUD will expand",
"name": "Direction",
"choices": {
"down": "Down",
"up": "Up"
}
},
"enabledForUser": {
"hint": "If enabled, the HUD is active for the user. Does not override the player permission setting.",
Expand Down
10 changes: 7 additions & 3 deletions lang/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,13 @@
"hint": "Activar el registro de depuración. (Esto se ha quedado por el camino, no esperes que sea muy útil)",
"name": "Activar la depuración"
},
"dropdown": {
"hint": "Si está activado, las categorías se despliegan hacia abajo, de lo contrario (¡cuidado!) se desplegarán hacia arriba a medias. No dudes en informar de cualquier error.",
"name": "Categorías desplegables hacia abajo"
"direction": {
"hint": "Establecer la dirección en la que se expandirá el HUD",
"name": "Dirección",
"choices": {
"down": "Abajo",
"up": "Arriba"
}
},
"enabledForUser": {
"hint": "Si está activado, el HUD se le mostrará al usuario. No reemplaza la configuración de los permisos del jugador.",
Expand Down
14 changes: 7 additions & 7 deletions lang/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,13 @@
"hint": "Active le log de debug. (Cette fonction est en quelque sorte tombée en désuétude, ne vous attendez pas à ce qu'elle soit très utile)",
"name": "Activer le debug"
},
"dorakoUI": {
"hint": "Enable the more compact and modern look of Dorako UI in any system.",
"name": "Enable Dorako UI (TAH Standalone)"
},
"dropdown": {
"hint": "Si activée, l'affichage des catégories se fait vers le bas, sinon il utilise une implémentation médiocre (avertissement !) vers le haut. N'hésitez pas à signaler tout bug.",
"name": "Catégories déroulant vers le bas"
"direction": {
"hint": "Définissez la direction dans laquelle le HUD se développera",
"name": "Direction",
"choices": {
"down": "Vers le bas",
"up": "En haut"
}
},
"enabledForUser": {
"hint": " Si activée, le HUD est actif pour le joueur. Ne vient pas écraser les permissions données au joueur.",
Expand Down
10 changes: 7 additions & 3 deletions lang/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,9 +119,13 @@
"hint": "Enable debug logging. (This has sort of fallen by the wayside, don't expect it to be very useful)",
"name": "Enable Debugging"
},
"dropdown": {
"hint": "If enabled, sets categories to drop down, otherwise uses a (warning!) half-assed drop-up implementation. Feel free to report any bugs.",
"name": "Dropdown Categories"
"direction": {
"hint": "Imposta la direzione in cui si espanderà l'HUD",
"name": "Direzione",
"choices": {
"down": "Fuori uso",
"up": "Su"
}
},
"enabledForUser": {
"hint": "If enabled, the HUD is active for the user. Does not override the player permission setting.",
Expand Down
14 changes: 7 additions & 7 deletions lang/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,13 @@
"hint": "デバッグ用のログを表示します(これは廃れてしまったので、あまり有用と期待しないでください)。",
"name": "デバッグ状態を有効化"
},
"dorakoUI": {
"hint": "よりコンパクトでモダンなDorako UIをあらゆるシステムで利用可能にします。",
"name": "Dorako UI を有効にする(TAH スタンドアロン)"
},
"dropdown": {
"hint": "有効にすると、カテゴリがドロップダウンするように設定できます。そうでない場合、(警告!)中途半端なドロップアップを使用します。バグがあれば、遠慮なく報告してください。",
"name": "ドロップダウン・カテゴリー"
"direction": {
"hint": "HUD が展開する方向を設定する",
"name": "方向",
"choices": {
"down": "",
"up": ""
}
},
"enabledForUser": {
"hint": "現在のユーザに自動的にホットバーを使用できる状態で初期化します。プレイヤーは設定を変更することで自分の好みに変更することができます。",
Expand Down
10 changes: 7 additions & 3 deletions lang/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,13 @@
"name": "디버깅 활성화",
"hint": "디버그 기록을 활성화한다."
},
"dropdown": {
"hint": "활성화시 카테고리를 드롭다운 형식으로 설정하며 그 외엔 (주의!)구린 드롭업을 사용한다. 버그가 있으면 언제든지 신고해주세요.",
"name": "카테고리 드롭다운"
"direction": {
"hint": "HUD가 확장되는 방향 설정",
"name": "방향",
"choices": {
"down": "아래에",
"up": "위로"
}
},
"enabledForUser": {
"name": "현재 유저에게 HUD를 활성화",
Expand Down
10 changes: 7 additions & 3 deletions lang/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,13 @@
"hint": "Enable debug logging. (This has sort of fallen by the wayside, don't expect it to be very useful)",
"name": "Enable Debugging"
},
"dropdown": {
"hint": "If enabled, sets categories to drop down, otherwise uses a (warning!) half-assed drop-up implementation. Feel free to report any bugs.",
"name": "Dropdown Categories"
"direction": {
"hint": "Ustaw kierunek, w którym HUD będzie się rozwijał",
"name": "Kierunek",
"choices": {
"down": "Na dół",
"up": "W górę"
}
},
"enabledForUser": {
"hint": "If enabled, the HUD is active for the user. Does not override the player permission setting.",
Expand Down
37 changes: 25 additions & 12 deletions scripts/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,31 @@ export const registerSettings = function (app, systemManager, rollHandlers) {
}
});

game.settings.register(appName, "direction", {
name: game.i18n.localize("tokenActionHud.settings.direction.name"),
hint: game.i18n.localize("tokenActionHud.settings.direction.hint"),
scope: "client",
config: true,
type: String,
default: "Down",
choices: {
up: game.i18n.localize("tokenActionHud.settings.direction.choices.up"),
down: game.i18n.localize("tokenActionHud.settings.direction.choices.down")
},
onChange: (value) => {
updateFunc(value);
},
});

// Migrate from 3.0.11 to 3.0.12
if (game.settings.storage.get("client").getItem("token-action-hud.dropdown") === "false") {
set("direction", "up");
game.settings.storage.get("client").removeItem("token-action-hud.dropdown");
}
if (game.settings.storage.get("client").getItem("token-action-hud.dropdown") === "true") {
game.settings.storage.get("client").removeItem("token-action-hud.dropdown");
}

game.settings.register(appName, "scale", {
name: game.i18n.localize("tokenActionHud.settings.scale.name"),
hint: game.i18n.localize("tokenActionHud.settings.scale.hint"),
Expand Down Expand Up @@ -201,18 +226,6 @@ export const registerSettings = function (app, systemManager, rollHandlers) {
},
});

game.settings.register(appName, "dropdown", {
name: game.i18n.localize("tokenActionHud.settings.dropdown.name"),
hint: game.i18n.localize("tokenActionHud.settings.dropdown.hint"),
scope: "client",
config: true,
type: Boolean,
default: true,
onChange: (value) => {
updateFunc(value);
},
});

game.settings.register(appName, "onTokenHover", {
name: game.i18n.localize("tokenActionHud.settings.onTokenHover.name"),
hint: game.i18n.localize("tokenActionHud.settings.onTokenHover.hint"),
Expand Down
11 changes: 5 additions & 6 deletions scripts/tokenactionhud.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,19 +289,18 @@ export class TokenActionHUD extends Application {
}

applySettings() {
if (!settings.get("dropdown")) {
$(document).find(".tah-content").css({
bottom: "40px",
"flex-direction": "column-reverse",
});
if (settings.get("direction") === "up") {
$(document).find(".tah-content").removeClass("expand-down");
$(document).find(".tah-content").addClass("expand-up");
$(document).find("#tah-character-name").addClass("tah-hidden");
}
}

// Positioning
trySetPos() {
if (!(this.targetActions && this.targetActions.tokenId)) return;

let hudTitle = $(document).find("#tah-hudTitle");
let hudTitle = $(document).find("#tah-character-name");
if (hudTitle.length > 0)
hudTitle.css("top", -hudTitle[0].getBoundingClientRect().height);

Expand Down
26 changes: 19 additions & 7 deletions styles/tah-compact.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
position: absolute;
}

#tah-hudTitle {
#tah-character-name {
color: #fff;
left: 4px;
margin: 0;
Expand Down Expand Up @@ -145,27 +145,35 @@
display: none;
overflow-y: auto;
overflow-x: hidden;
padding-top: 2px;
padding: 2px;
}

.tah-content.expand-up {
bottom: 20px;
flex-direction: column-reverse;
}

.tah-content.expand-down {
flex-direction: column;
padding-top: 3px;
}

/* Show the dropdown menu on hover */
.tah-category.hover .tah-content {
background: none;
display: flex;
flex-direction: column;
left: -175px;
padding: 1px;
left: -178px;
position: absolute;
}

.tah-subcategory {
cursor: default;
display: flex;
padding-top: 3px;
padding: 1.5px;
}

.tah-subtitle-wrapper {
display: flex;
padding-top: 3px;
}

.tah-subtitle {
Expand Down Expand Up @@ -424,4 +432,8 @@
0 0 0 1px var(--tah-button-outline-hover, red),
0 0 10px var(--tah-button-outline-hover-glow, #ff6400);
color: var(--tah-button-active-contrast, #fff);
}

.tah-hidden {
display: none !important;
}
Loading

0 comments on commit beb84b1

Please sign in to comment.