fixed help modal not showing on mobile

This commit is contained in:
Demetri Pirpiris 2025-03-15 14:30:48 -06:00
parent b56f6cf490
commit 2d3969d160
2 changed files with 24 additions and 16 deletions

View File

@ -2,7 +2,7 @@
<html lang="en"> <html lang="en">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<title>Neon Synthwave Snake Evolution Simulator</title> <title>Gummy Arena Simulator</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="styles.css"> <link rel="stylesheet" href="styles.css">
</head> </head>
@ -185,7 +185,7 @@
<div class="control-group"> <div class="control-group">
<label for="snakeSpeedSlider">Snake Speed:</label> <label for="snakeSpeedSlider">Snake Speed:</label>
<input type="range" id="snakeSpeedSlider" min="1" max="50" step="0.1" value="3.5"> <input type="range" id="snakeSpeedSlider" min="1" max="50" step="0.1" value="3.5">
<span id="snakeSpeedVal">3.5</span> <span id="snakeSpeedVal">0</span>
<div class="setting-description"> <div class="setting-description">
Snakes turn at a rate up to 0.15 / (lengthFactor) * speed; higher is more agile. Snakes turn at a rate up to 0.15 / (lengthFactor) * speed; higher is more agile.
</div> </div>

View File

@ -17,7 +17,7 @@ const DEFAULT_DROPPED_FOOD_POINTS = 10;
const DEFAULT_SURVIVAL_BONUS = 2; const DEFAULT_SURVIVAL_BONUS = 2;
const DEFAULT_BODY_LENGTH_INCREMENT = 10; const DEFAULT_BODY_LENGTH_INCREMENT = 10;
const DEFAULT_THICKNESS_INCREMENT = 0.05; const DEFAULT_THICKNESS_INCREMENT = 0.05;
const DEFAULT_SNAKE_COUNT = 15; const DEFAULT_SNAKE_COUNT = 20;
const DEFAULT_LENGTH_BONUS = 3; const DEFAULT_LENGTH_BONUS = 3;
const DEFAULT_KILL_BONUS = 3; const DEFAULT_KILL_BONUS = 3;
@ -175,6 +175,15 @@ function updateLayout() {
removeDraggable(tlPanel); removeDraggable(tlPanel);
removeDraggable(ctrlPanel); removeDraggable(ctrlPanel);
// RE-wire help button in the new clone
const helpBtn = document.getElementById('helpButton');
const helpModal = document.getElementById('helpModal');
const helpClose = document.getElementById('helpClose');
if (helpBtn && helpModal && helpClose) {
helpBtn.onclick = () => { helpModal.style.display = 'flex'; };
helpClose.onclick = () => { helpModal.style.display = 'none'; };
}
} }
} }
@ -536,6 +545,18 @@ function wireUIEvents() {
updateControlValue('respawnDelayVal', DEFAULT_RESPAWN_DELAY); updateControlValue('respawnDelayVal', DEFAULT_RESPAWN_DELAY);
updateControlValue('foodDecayTimeVal', DEFAULT_FOOD_DECAY_TIME); updateControlValue('foodDecayTimeVal', DEFAULT_FOOD_DECAY_TIME);
// Wire up the help button to open the modal
const helpBtn = document.getElementById('helpButton');
const helpModal = document.getElementById('helpModal');
const helpClose = document.getElementById('helpClose');
if (helpBtn && helpModal && helpClose) {
helpBtn.onclick = () => {
helpModal.style.display = 'flex';
};
helpClose.onclick = () => {
helpModal.style.display = 'none';
};
}
} }
/* Adjust snake population */ /* Adjust snake population */
@ -1186,18 +1207,5 @@ function init() {
attachTopLevelTabLogic(document.getElementById("timeAndLeaderboardPanel")); attachTopLevelTabLogic(document.getElementById("timeAndLeaderboardPanel"));
wireUIEvents(); wireUIEvents();
// Wire up the help button to open the modal
const helpBtn = document.getElementById('helpButton');
const helpModal = document.getElementById('helpModal');
const helpClose = document.getElementById('helpClose');
if (helpBtn && helpModal && helpClose) {
helpBtn.onclick = () => {
helpModal.style.display = 'flex';
};
helpClose.onclick = () => {
helpModal.style.display = 'none';
};
}
} }
init(); init();