diff --git a/src/ui/league_table_range_dialog.cpp b/src/ui/league_table_range_dialog.cpp index 254d4dc..8293484 100644 --- a/src/ui/league_table_range_dialog.cpp +++ b/src/ui/league_table_range_dialog.cpp @@ -287,7 +287,12 @@ bool LeagueTableRangeDialog::activate_cell(int index) { bool LeagueTableRangeDialog::pointer_down(int px, int py, bool right) { if (outcome_delivered_) return false; - if (right) return true; // modal consumes RMB but does not infer Source event 8 + if (right) { + // The right button leaves the calculator as event 8 does (as the Toto calculator); the exit + // still waits for its final Present. The modal consumes the press either way. + (void)cancel_from_source_event(); + return true; + } if (dragging_) { pointer_x_ = px; pointer_y_ = py; diff --git a/src/ui/stadium.cpp b/src/ui/stadium.cpp index 26be94d..f20fc59 100644 --- a/src/ui/stadium.cpp +++ b/src/ui/stadium.cpp @@ -858,12 +858,6 @@ void StadiumScreen::render_panorama(Image& out) const { } if (periphery_hover_ < 0) return; const size_t object = size_t(periphery_hover_); - { - // the hit rectangle of the object under the pointer, framed in yellow as on the advertising page - const size_t at = ::bmh::layout::Stadium_PeripheryObjectContains_ExecutableField + object * 8; - const int left = exe_.u16(at), top = exe_.u16(at + 2), right = exe_.u16(at + 4), bottom = exe_.u16(at + 6); - outline(out, left, top, right - left + 1, bottom - top + 1, 0x27); - } copy_crop(out, periphery_overlay_, 8, 7, 26, 32, 180, 27); const bool busy = state_.days[object] != 0; const std::string title = texts_[text_id(::bmh::layout::Stadium_RenderPanorama_TextPointer + unsigned(object) * 4)] + diff --git a/tests/bank_app_tests.cpp b/tests/bank_app_tests.cpp index b0cf557..c0714dc 100644 --- a/tests/bank_app_tests.cpp +++ b/tests/bank_app_tests.cpp @@ -186,6 +186,14 @@ void test_toto_source_calculator(const std::filesystem::path& data) { check(cancelled_result && cancelled_result->result == TableRangeDialogResult::cancel, "Toto calculator cancel has no accepted payment value"); + LeagueTableRangeDialog by_mouse(data, backdrop, TotoStakeDialogProfile{TableRangeTextMode::flat}); + (void)by_mouse.render(); (void)by_mouse.after_present(); + check(by_mouse.pointer_down(10, 10, true), "the right button is consumed by the calculator"); + check(by_mouse.render().pixels == backdrop.pixels, "the right button restores the owned backdrop"); + const auto by_mouse_result = by_mouse.after_present(); + check(by_mouse_result && by_mouse_result->result == TableRangeDialogResult::cancel, + "the right button closes the calculator as a cancel"); + TableRangeDialogProfile table_profile; table_profile.text_mode = TableRangeTextMode::flat; LeagueTableRangeDialog table(data, backdrop, table_profile);