Skip to content

Commit

Permalink
Fixed rotate-tracker state
Browse files Browse the repository at this point in the history
* Fixed the tracker graphic rotation state to be the saved state on initialisation.
  • Loading branch information
DameryDad committed Sep 21, 2024
1 parent 6f69fa3 commit bbf0c50
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 24 deletions.
28 changes: 16 additions & 12 deletions RoundMaster/5.057/RoundMaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down Expand Up @@ -5164,10 +5170,8 @@ var RoundMaster = (function() {
}

updateTurnorderMarker();
if (!flags.animating) {
flags.animating = state.roundMaster.rotation;
animateTracker();
}
flags.animating = state.roundMaster.rotation;
animateTracker();
};

/**
Expand Down
28 changes: 16 additions & 12 deletions RoundMaster/RoundMaster.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
};

Expand Down Expand Up @@ -5164,10 +5170,8 @@ var RoundMaster = (function() {
}

updateTurnorderMarker();
if (!flags.animating) {
flags.animating = state.roundMaster.rotation;
animateTracker();
}
flags.animating = state.roundMaster.rotation;
animateTracker();
};

/**
Expand Down

0 comments on commit bbf0c50

Please sign in to comment.