Retain live ticker controls during independent detail navigation (by Codex)

This commit is contained in:
Codex committed 2026-10-27 21:03:45 +01:00
1 parent d3ea650c07
commit 1fb6499b15
5 files changed
+116 -18

No files matched your search

+18 -5
View File
@@ -88,16 +88,20 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
if (!action.starts_with("live-")) return false;
if (scene_ != "live" || !live_.available()) return true;
const auto id = target ? target->GetAttribute<Rml::String>("data-id", "") : "";
bool detail_only = false, ticker_only = false;
if (!live_dialog_.empty() && action != "live-dialog-cancel" && action != "live-dialog-apply" && action != "live-tactic-cycle") return true;
if (action == "live-back") { live_close(); return true; }
if (action == "live-owner-prev" || action == "live-owner-next") {
live_.cycle_owner(action == "live-owner-prev" ? -1 : 1); live_reset_detail_ = true;
if (!live_.cycle_owner(action == "live-owner-prev" ? -1 : 1)) return true;
live_reset_detail_ = detail_only = true;
} else if (action == "live-tab") {
if (id != "team" && id != "tactics" && id != "opponent" && id != "table" && id != "stats") return true;
live_tab_ = id; live_reset_detail_ = true;
if (live_tab_ == id) return true;
live_tab_ = id; live_reset_detail_ = detail_only = true;
} else if (action == "live-filter") {
if (id != "all" && id != "highlights" && id != "goal" && id != "yellow") return true;
live_filter_ = id; live_reset_ticker_ = true;
if (live_filter_ == id) return true;
live_filter_ = id; live_reset_ticker_ = ticker_only = true;
} else if (action == "live-coverage") {
if (id != "all" && id != "single" && id != "conference") return true;
live_coverage_ = id; live_reset_ticker_ = true;
@@ -114,7 +118,7 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
} else if (action == "live-next") {
live_.next(); live_last_tick_ = SDL_GetTicks64();
} else if (action == "live-pause") {
live_set_speed(live_.speed() ? 0 : 1);
live_set_speed(live_.speed() ? 0 : 1); return true;
} else if (action == "live-review" && live_.finished()) {
postmatch_open();return true;
} else if (action == "live-review-back") {
@@ -140,6 +144,12 @@ bool App::live_action(const std::string &action, Rml::Element *target) {
} catch (const std::exception &) { return true; }
} else return true;
if (target && focus_after_render_.empty()) focus_after_render_ = target->GetId();
if (detail_only || ticker_only) {
live_detail_pending_ = live_detail_pending_ || detail_only;
live_ticker_pending_ = live_ticker_pending_ || ticker_only;
dirty_ = true;
return true;
}
refresh(); return true;
}
bool App::live_event(Rml::Event &event) {
@@ -151,7 +161,7 @@ bool App::live_event(Rml::Event &event) {
if (type == "mousedown" && speed_control) live_speed_dragging_ = true;
if (type == "mouseup" && live_speed_dragging_) {
live_speed_dragging_ = false; live_last_tick_ = SDL_GetTicks64();
focus_after_render_ = "live-speed"; needs_render_ = true;
focus_after_render_ = "live-speed"; dirty_ = true;
}
if ((type == "change" || type == "input") && speed_control) {
if (setting_menu_markup_) return true;
@@ -209,6 +219,9 @@ Json App::live_snapshot() const {
status["drafts"] = live_drafts_; status["dialog_draft"] = live_dialog_draft_;
status["ticker_scroll"] = element("live-ticker") ? element("live-ticker")->GetScrollTop() : live_ticker_scroll_;
status["frame"] = live_.frame();
// Diagnostic counts describe actual DOM updates, not hardware timing claims.
status["ui_updates"] = {{"document", document_generation_},
{"detail", live_detail_updates_}, {"ticker", live_ticker_updates_}};
if (live_.available()) { status["owners"] = live_.fixture().at("owners"); status["matches"] = live_.fixture().at("matches"); }
return status;
}