From 8f4e3d0b1151d5131f5a3ee36e52ebfab35c4be4 Mon Sep 17 00:00:00 2001 From: yukirij Date: Fri, 30 Aug 2024 17:39:00 -0700 Subject: [PATCH] Add animation to previous play button; fix replay auto handling on bar select. --- www/js/interface.js | 15 +++++++-------- www/js/scene.js | 10 +++++----- 2 files changed, 12 insertions(+), 13 deletions(-) diff --git a/www/js/interface.js b/www/js/interface.js index 7a5efd5..5069377 100644 --- a/www/js/interface.js +++ b/www/js/interface.js @@ -1108,19 +1108,15 @@ const INTERFACE = { } }, replay_first() { - INTERFACE_DATA.replay_auto = false; INTERFACE.replay_jump(0); }, - replay_last() { - INTERFACE_DATA.replay_auto = false; - INTERFACE.replay_jump(INTERFACE_DATA.history.length); + replay_last(animate=false) { + INTERFACE.replay_jump(INTERFACE_DATA.history.length, animate); }, - replay_prev() { - INTERFACE_DATA.replay_auto = false; - INTERFACE.replay_jump(INTERFACE_DATA.replay_turn - 1); + replay_prev(animate=false) { + INTERFACE.replay_jump(INTERFACE_DATA.replay_turn - 1, animate); }, replay_next(animate=false) { - INTERFACE_DATA.replay_auto = false; INTERFACE.replay_jump(INTERFACE_DATA.replay_turn + 1, animate); }, replay_toggle_auto() { @@ -1135,6 +1131,9 @@ const INTERFACE = { setTimeout(INTERFACE.replay_auto, 1100); } }, + replay_off() { + INTERFACE_DATA.replay_auto = false; + }, auto() { diff --git a/www/js/scene.js b/www/js/scene.js index b4c31ea..8d9e996 100644 --- a/www/js/scene.js +++ b/www/js/scene.js @@ -581,15 +581,15 @@ const SCENES = { [ ], [ UI.button("Auto", () => { INTERFACE.replay_toggle_auto(); }), - UI.button("◀", () => { INTERFACE.replay_first(); }), - UI.button("◁", () => { INTERFACE.replay_prev(); }), + UI.button("◀", () => { INTERFACE.replay_off(); INTERFACE.replay_first(); }), + UI.button("◁", () => { INTERFACE.replay_off(); INTERFACE.replay_prev(true); }), ind_turn, - UI.button("▷", () => { INTERFACE.replay_next(true); }), - UI.button("▶", () => { INTERFACE.replay_last(); }), + UI.button("▷", () => { INTERFACE.replay_off(); INTERFACE.replay_next(true); }), + 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("max", "0"); MAIN.appendChild(UI.div([ slider ], "turn-slider-padding"));