affichage de la partie

This commit is contained in:
Didictateur 2025-10-18 23:21:30 +02:00
parent 1571094ed5
commit ce81438c48
4 changed files with 13 additions and 1 deletions

View file

@ -34,7 +34,7 @@
</div> </div>
<script src="https://cdn.socket.io/4.5.4/socket.io.min.js"></script> <script src="https://cdn.socket.io/4.5.4/socket.io.min.js"></script>
<script src="src/game.js?v=3"></script> <script src="src/game.js?v=4"></script>
<script> <script>
// small bootstrap: fetch initial game state and wire socket updates // small bootstrap: fetch initial game state and wire socket updates
(function(){ (function(){

View file

@ -97,11 +97,13 @@ function renderBoardFromState(state, asWhite = null) {
} }
} }
container.appendChild(boardEl); container.appendChild(boardEl);
// (previously: overlay/drawing code removed per user request)
// ensure player color display is in sync // ensure player color display is in sync
try{ const pc = document.getElementById('player-color'); if(pc && window && window.myColor) pc.textContent = 'Couleur: ' + window.myColor; }catch(e){} try{ const pc = document.getElementById('player-color'); if(pc && window && window.myColor) pc.textContent = 'Couleur: ' + window.myColor; }catch(e){}
console.log('renderBoardFromState: board appended (w=' + w + ', h=' + h + ')'); console.log('renderBoardFromState: board appended (w=' + w + ', h=' + h + ')');
} }
function setMeta(text) { q('#meta').textContent = text; } function setMeta(text) { q('#meta').textContent = text; }
function renderPlayersList(gameObj){ function renderPlayersList(gameObj){

View file

@ -10,7 +10,9 @@ function renderBoardFromState(state) {
const container = q('#board-container'); const container = q('#board-container');
if(!container){ console.error('renderBoardFromState: #board-container not found'); return; } if(!container){ console.error('renderBoardFromState: #board-container not found'); return; }
console.log('renderBoardFromState called, state present?', !!state); console.log('renderBoardFromState called, state present?', !!state);
// clear previous board and overlays
container.innerHTML = ''; container.innerHTML = '';
removeExistingOverlay(container);
const boardEl = document.createElement('div'); const boardEl = document.createElement('div');
boardEl.className = 'board'; boardEl.className = 'board';
@ -67,9 +69,11 @@ function renderBoardFromState(state) {
} }
} }
container.appendChild(boardEl); container.appendChild(boardEl);
// (previously: overlay/drawing code removed per user request)
console.log('renderBoardFromState: board appended (w=' + w + ', h=' + h + ')'); console.log('renderBoardFromState: board appended (w=' + w + ', h=' + h + ')');
} }
function setMeta(text) { q('#meta').textContent = text; } function setMeta(text) { q('#meta').textContent = text; }
q('#create-only')?.addEventListener('click', async () => { q('#create-only')?.addEventListener('click', async () => {

View file

@ -22,3 +22,9 @@ main{padding:16px}
/* Ensure selected cells have no visual effect (display-only mode) */ /* Ensure selected cells have no visual effect (display-only mode) */
.cell.selected{outline: none !important; box-shadow: none !important; border-color: inherit !important; background: inherit !important} .cell.selected{outline: none !important; box-shadow: none !important; border-color: inherit !important; background: inherit !important}
/* Overlay for drawings (arrows/circles) */
.board-overlay-wrapper{position:relative;width:100%;height:100%;}
.board-overlay{position:absolute;top:0;left:0;right:0;bottom:0;pointer-events:auto;z-index:30}
.overlay-controls button{background:rgba(255,255,255,0.9);border:1px solid #ccc;padding:6px 8px;border-radius:4px;cursor:pointer}
.overlay-controls button:hover{filter:brightness(0.95)}