From 6185ba086527910f964e2c5b681d7fb62a730d41 Mon Sep 17 00:00:00 2001 From: Tobias Date: Wed, 30 Aug 2023 11:28:36 +0200 Subject: [PATCH] fixed a bug where actions menus wouldn't close on clicking in an empty space --- src/js/sr2ini.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/js/sr2ini.js b/src/js/sr2ini.js index 71d90c6..fe2ac15 100644 --- a/src/js/sr2ini.js +++ b/src/js/sr2ini.js @@ -28,7 +28,7 @@ const DAMAGE_PENALTY = [0, 1, 1, 2, 2, 2, 3, 3, 3, 3, 4]; const DAMAGE_NIVEAU = ["", "L", "M", "S", "D"]; const COMBATANT_TABLE_ROW = [ -'\n', //TODO: add data-damage-* attributes with initial damage levels +'\n', '\n', '\n', 'D+\n', @@ -499,11 +499,14 @@ $(document).ready(function () { $('#combatant-modal').on('shown.bs.modal', () => $('#combatant-modal-name').focus()); // always empty input fields when combatant modal disappears $("#combatant-modal").on('hidden.bs.modal', () => $("input[id*='combatant-modal']").val("")); - // Hide damage monitors after click somewhere else + // Hide damage monitors and actions menus after click somewhere else $("html").on("click", (e) => { if ($(e.target).parents(".damage-monitor").length == 0) { $(".damage-monitor.seen").removeClass("seen"); } + if ($(e.target).parents(".actions-menu").length == 0) { + $(".actions-menu.seen").removeClass("seen"); + } }); addTestCombatant(); });