Add toggle for auto map-centering

This commit is contained in:
2025-06-16 22:41:34 -07:00
parent 06bff39f01
commit 0af6380fee
4 changed files with 24 additions and 10 deletions

View File

@@ -269,7 +269,7 @@ document.querySelectorAll('[name="select-elevation"]').forEach(el => {
});
});
document.querySelector('#toggle-grid-vis input').addEventListener('change', function () {
document.querySelector('#toggle-grid-vis').addEventListener('change', function () {
const svg = document.querySelector('object').contentDocument.querySelector('svg');
svg.querySelector('.grid').style.display = this.checked ? 'inline' : 'none';
svg.querySelector('#dots').style.display = this.checked ? 'inline' : 'none';

View File

@@ -192,7 +192,7 @@ function select(data, opts) {
if (isSelected || !data) return;
if (opts?.revealCounter) {
if (opts?.revealCounter && document.querySelector('#auto-center-map').checked) {
const gb = svg.querySelector('.gameboard');
if (gb.contains(counter)) manualPan(gb, counter);
}