Skip to content

Commit b8db372

Browse files
committed
fix(RoadKit.js): instructions on top of pieces so they can be dismissed on smaller screens
1 parent 6f4372d commit b8db372

File tree

1 file changed

+22
-22
lines changed

1 file changed

+22
-22
lines changed

src/scripts/roadkits/RoadKit.js

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -311,28 +311,6 @@ export default class RoadKit {
311311
// Append the button to the document body
312312
addUIElement(closeButton);
313313

314-
// Create the instructions
315-
const editInfo = document.createElement('div');
316-
editInfo.className = 'text-light p-3 rounded-1';
317-
editInfo.id = 'editInfo';
318-
editInfo.innerHTML =
319-
`<button type="button" class="btn btn-danger" aria-label="Close">X</button>
320-
<p class="lead">Tile Editor Instructions:</p>
321-
<ul class="list-group text-light">
322-
<li class="list-group-item text-light">Click a road tile on the rug and move your mouse to move it.</li>
323-
<li class="list-group-item text-light">Click a tile button to create a new tile.</li>
324-
<li class="list-group-item text-light">Click on the rug to place the tile. This will delete any tiles in its position.</li>
325-
<li class="list-group-item text-light">While a tile is selected, press A or D to rotate it.</li>
326-
<li class="list-group-item text-light">Press Delete to remove a selected tile.</li>
327-
</ul>`
328-
329-
// Append the instructions to the document body
330-
addUIElement(editInfo);
331-
332-
document.querySelector('#editInfo button').addEventListener('click', e => {
333-
removeUIElement(editInfo);
334-
});
335-
336314
// Create the tile selection buttons
337315
const tileSelection = document.createElement('div');
338316
tileSelection.className = 'bg-dark text-center rounded-1';
@@ -358,6 +336,28 @@ export default class RoadKit {
358336
document.querySelector(`#${id}`).addEventListener('click', handler);
359337
});
360338

339+
// Create the instructions
340+
const editInfo = document.createElement('div');
341+
editInfo.className = 'text-light p-3 rounded-1';
342+
editInfo.id = 'editInfo';
343+
editInfo.innerHTML =
344+
`<button type="button" class="btn btn-danger" aria-label="Close">X</button>
345+
<p class="lead">Tile Editor Instructions:</p>
346+
<ul class="list-group text-light">
347+
<li class="list-group-item text-light">Click a road tile on the rug and move your mouse to move it.</li>
348+
<li class="list-group-item text-light">Click a tile button to create a new tile.</li>
349+
<li class="list-group-item text-light">Click on the rug to place the tile. This will delete any tiles in its position.</li>
350+
<li class="list-group-item text-light">While a tile is selected, press A or D to rotate it.</li>
351+
<li class="list-group-item text-light">Press Delete to remove a selected tile.</li>
352+
</ul>`
353+
354+
// Append the instructions to the document body
355+
addUIElement(editInfo);
356+
357+
document.querySelector('#editInfo button').addEventListener('click', e => {
358+
removeUIElement(editInfo);
359+
});
360+
361361
// Configure key down events to rotate and delete tiles
362362
// Bind _handleKeyDown so this context can be accessed
363363
this._handleKeydownBound = this._handleKeydown.bind(this);

0 commit comments

Comments
 (0)