Add animation to previous play button; fix replay auto handling on bar select.

This commit is contained in:
yukirij 2024-08-30 17:39:00 -07:00
parent db227227c9
commit 8f4e3d0b11
2 changed files with 12 additions and 13 deletions

View File

@ -1108,19 +1108,15 @@ const INTERFACE = {
} }
}, },
replay_first() { replay_first() {
INTERFACE_DATA.replay_auto = false;
INTERFACE.replay_jump(0); INTERFACE.replay_jump(0);
}, },
replay_last() { replay_last(animate=false) {
INTERFACE_DATA.replay_auto = false; INTERFACE.replay_jump(INTERFACE_DATA.history.length, animate);
INTERFACE.replay_jump(INTERFACE_DATA.history.length);
}, },
replay_prev() { replay_prev(animate=false) {
INTERFACE_DATA.replay_auto = false; INTERFACE.replay_jump(INTERFACE_DATA.replay_turn - 1, animate);
INTERFACE.replay_jump(INTERFACE_DATA.replay_turn - 1);
}, },
replay_next(animate=false) { replay_next(animate=false) {
INTERFACE_DATA.replay_auto = false;
INTERFACE.replay_jump(INTERFACE_DATA.replay_turn + 1, animate); INTERFACE.replay_jump(INTERFACE_DATA.replay_turn + 1, animate);
}, },
replay_toggle_auto() { replay_toggle_auto() {
@ -1135,6 +1131,9 @@ const INTERFACE = {
setTimeout(INTERFACE.replay_auto, 1100); setTimeout(INTERFACE.replay_auto, 1100);
} }
}, },
replay_off() {
INTERFACE_DATA.replay_auto = false;
},
auto() { auto() {

View File

@ -581,15 +581,15 @@ const SCENES = {
[ ], [ ],
[ [
UI.button("Auto", () => { INTERFACE.replay_toggle_auto(); }), UI.button("Auto", () => { INTERFACE.replay_toggle_auto(); }),
UI.button("◀", () => { INTERFACE.replay_first(); }), UI.button("◀", () => { INTERFACE.replay_off(); INTERFACE.replay_first(); }),
UI.button("◁", () => { INTERFACE.replay_prev(); }), UI.button("◁", () => { INTERFACE.replay_off(); INTERFACE.replay_prev(true); }),
ind_turn, ind_turn,
UI.button("▷", () => { INTERFACE.replay_next(true); }), UI.button("▷", () => { INTERFACE.replay_off(); INTERFACE.replay_next(true); }),
UI.button("▶", () => { INTERFACE.replay_last(); }), UI.button("▶", () => { INTERFACE.replay_off(); INTERFACE.replay_last(true); }),
] ]
); );
let slider = UI.slider("turn-slider", (event) => { INTERFACE.replay_jump(event.target.value, true); }); let slider = UI.slider("turn-slider", (event) => { INTERFACE.replay_off(); INTERFACE.replay_jump(event.target.value, true); });
slider.setAttribute("min", "0"); slider.setAttribute("min", "0");
slider.setAttribute("max", "0"); slider.setAttribute("max", "0");
MAIN.appendChild(UI.div([ slider ], "turn-slider-padding")); MAIN.appendChild(UI.div([ slider ], "turn-slider-padding"));