From bbf0c5041910f285ba3309b9a4b041d9ba517ad7 Mon Sep 17 00:00:00 2001 From: DameryDad <74715860+DameryDad@users.noreply.github.com> Date: Sat, 21 Sep 2024 15:17:33 +0100 Subject: [PATCH] Fixed rotate-tracker state * Fixed the tracker graphic rotation state to be the saved state on initialisation. --- RoundMaster/5.057/RoundMaster.js | 28 ++++++++++++++++------------ RoundMaster/RoundMaster.js | 28 ++++++++++++++++------------ 2 files changed, 32 insertions(+), 24 deletions(-) diff --git a/RoundMaster/5.057/RoundMaster.js b/RoundMaster/5.057/RoundMaster.js index cd1bfd813..796cd3c95 100644 --- a/RoundMaster/5.057/RoundMaster.js +++ b/RoundMaster/5.057/RoundMaster.js @@ -4800,21 +4800,27 @@ var RoundMaster = (function() { * * TODO make the rotation rate a field variable */ + var animateTracker = function() { - if (!flags.animating) - {return;} - if (flags.rw_state === RW_StateEnum.ACTIVE) { + if (!flags.animating) { + return; + } + if (flags.rw_state == RW_StateEnum.ACTIVE) { +// log('doAnimateTracker: Active'); if (state.roundMaster.rotation) { var graphic = findTrackerGraphic(); - graphic.set('rotation',parseInt(graphic.get('rotation'))+fields.rotation_degree); + graphic.set('rotation',(parseInt(graphic.get('rotation'))+parseInt(fields.rotation_degree))); +// log('doAnimateTracker: Rotating'); } setTimeout(function() {animateTracker();},500); - } else if (flags.rw_state === RW_StateEnum.PAUSED - || flags.rw_state === RW_StateEnum.FROZEN) { - setTimeout(function() {animateTracker();},500); + } else if (flags.rw_state == RW_StateEnum.PAUSED + || flags.rw_state == RW_StateEnum.FROZEN) { +// log('doAnimateTracker: Paused or Frozen'); + setTimeout(function() {animateTracker();},1000); } else { - flags.animating = false; + log('doAnimateTracker: Stopped or undefined'); +// flags.animating = false; } }; @@ -5164,10 +5170,8 @@ var RoundMaster = (function() { } updateTurnorderMarker(); - if (!flags.animating) { - flags.animating = state.roundMaster.rotation; - animateTracker(); - } + flags.animating = state.roundMaster.rotation; + animateTracker(); }; /** diff --git a/RoundMaster/RoundMaster.js b/RoundMaster/RoundMaster.js index cd1bfd813..796cd3c95 100644 --- a/RoundMaster/RoundMaster.js +++ b/RoundMaster/RoundMaster.js @@ -4800,21 +4800,27 @@ var RoundMaster = (function() { * * TODO make the rotation rate a field variable */ + var animateTracker = function() { - if (!flags.animating) - {return;} - if (flags.rw_state === RW_StateEnum.ACTIVE) { + if (!flags.animating) { + return; + } + if (flags.rw_state == RW_StateEnum.ACTIVE) { +// log('doAnimateTracker: Active'); if (state.roundMaster.rotation) { var graphic = findTrackerGraphic(); - graphic.set('rotation',parseInt(graphic.get('rotation'))+fields.rotation_degree); + graphic.set('rotation',(parseInt(graphic.get('rotation'))+parseInt(fields.rotation_degree))); +// log('doAnimateTracker: Rotating'); } setTimeout(function() {animateTracker();},500); - } else if (flags.rw_state === RW_StateEnum.PAUSED - || flags.rw_state === RW_StateEnum.FROZEN) { - setTimeout(function() {animateTracker();},500); + } else if (flags.rw_state == RW_StateEnum.PAUSED + || flags.rw_state == RW_StateEnum.FROZEN) { +// log('doAnimateTracker: Paused or Frozen'); + setTimeout(function() {animateTracker();},1000); } else { - flags.animating = false; + log('doAnimateTracker: Stopped or undefined'); +// flags.animating = false; } }; @@ -5164,10 +5170,8 @@ var RoundMaster = (function() { } updateTurnorderMarker(); - if (!flags.animating) { - flags.animating = state.roundMaster.rotation; - animateTracker(); - } + flags.animating = state.roundMaster.rotation; + animateTracker(); }; /**