fixed jumpy clock hands when someone joins in the middle of a vote (fixes #49)

This commit is contained in:
Steffen 2020-07-23 10:39:48 +02:00
parent 0f35f009f8
commit fd75b1771f
No known key found for this signature in database
GPG Key ID: 764D74E98267DFC6
3 changed files with 7 additions and 5 deletions

View File

@ -32,11 +32,11 @@ const mutations = {
setPlayerCount: set("playerCount"), setPlayerCount: set("playerCount"),
setVotingSpeed: set("votingSpeed"), setVotingSpeed: set("votingSpeed"),
claimSeat: set("claimedSeat"), claimSeat: set("claimedSeat"),
nomination(state, { nomination, votes, votingSpeed } = {}) { nomination(state, { nomination, votes, votingSpeed, lockedVote } = {}) {
state.nomination = nomination || false; state.nomination = nomination || false;
state.votes = votes || []; state.votes = votes || [];
state.votingSpeed = votingSpeed || state.votingSpeed; state.votingSpeed = votingSpeed || state.votingSpeed;
state.lockedVote = 0; state.lockedVote = lockedVote || 0;
}, },
/** /**
* Store a vote with and without syncing it to the live session. * Store a vote with and without syncing it to the live session.

View File

@ -183,6 +183,7 @@ class LiveSession {
gamestate: this._gamestate, gamestate: this._gamestate,
nomination: session.nomination, nomination: session.nomination,
votingSpeed: session.votingSpeed, votingSpeed: session.votingSpeed,
lockedVote: session.lockedVote,
...(session.nomination ? { votes: session.votes } : {}) ...(session.nomination ? { votes: session.votes } : {})
}); });
} }
@ -194,11 +195,12 @@ class LiveSession {
*/ */
_updateGamestate(data) { _updateGamestate(data) {
if (!this._isSpectator) return; if (!this._isSpectator) return;
const { gamestate, nomination, votingSpeed, votes } = data; const { gamestate, nomination, votingSpeed, votes, lockedVote } = data;
this._store.commit("session/nomination", { this._store.commit("session/nomination", {
nomination, nomination,
votes, votes,
votingSpeed votingSpeed,
lockedVote
}); });
const players = this._store.state.players.players; const players = this._store.state.players.players;
// adjust number of players // adjust number of players