index : btroops | |
Virtual board game-aid for BattleTroops, an infantry combat simulator wargame published by FASA in 1989. |
aboutsummaryrefslogtreecommitdiff |
diff options
author | Catalin Mititiuc <webdevcat@proton.me> | 2024-08-08 15:27:12 -0700 |
---|---|---|
committer | Catalin Mititiuc <webdevcat@proton.me> | 2024-08-08 15:27:12 -0700 |
commit | 23188152c91a8e638ab832fa1fa122d59d1fc391 (patch) | |
tree | d8568304a5b4b91f4864a540619493a511a4bb24 /src/modules/record_sheet.js | |
parent | b970b34a8848a65a44f1e3a64465270845371492 (diff) |
Add additional params to observable calls; reveal counter and record logic on selections
Diffstat (limited to 'src/modules/record_sheet.js')
-rw-r--r-- | src/modules/record_sheet.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/modules/record_sheet.js b/src/modules/record_sheet.js index 241725d..fb0b037 100644 --- a/src/modules/record_sheet.js +++ b/src/modules/record_sheet.js @@ -359,7 +359,7 @@ function reveal(record) { record.scrollIntoView({ behavior: 'smooth' }); } -function select(data) { +function select(data, opts) { const record = data && getRecord(data); const isSelected = record?.classList.contains('selected'); @@ -367,7 +367,7 @@ function select(data) { if (isSelected || !data) return; - reveal(record); + if (opts?.revealRecord) reveal(record); record.classList.add('selected'); } @@ -381,7 +381,7 @@ function endMove() { selected.classList.toggle('movement-ended'); deselect(); - if (next) Observable.notify('select', next); + if (next) Observable.notify('select', next, { revealCounter: true, revealRecord: true }); } } @@ -421,7 +421,7 @@ export function start(startLoc, units) { } document.querySelectorAll('.soldier-record').forEach(el => - el.addEventListener('click', () => Observable.notify('select', el)) + el.addEventListener('click', () => Observable.notify('select', el, { revealCounter: true })) ); Observable.subscribe('select', select); |