Don't Scroll in Scrollbar

This commit is contained in:
tobid7 2024-06-26 08:04:43 +02:00
parent b737ab1350
commit 586134787c

View File

@ -822,16 +822,17 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
ui7_ctx->cm->scrolling_mod = 0.f;
}
if (ui7_ctx->cm->has_touch) {
auto np = RenderD7::Hid::GetTouchPosition();
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Down)) {
// Set the mdp Value as Start Pos
ui7_ctx->cm->mdp = RenderD7::Hid::GetTouchPosition();
ui7_ctx->cm->mdp = np;
} else if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Up)) {
// 0 out the start pos
ui7_ctx->cm->mdp = R7Vec2();
}
if (RenderD7::Hid::IsEvent("touch", RenderD7::Hid::Held)) {
// Set modifier
auto np = RenderD7::Hid::GetTouchPosition();
if(!InBox(np, R7Vec2(RenderD7::R2()->GetCurrentScreenSize().x - 8 - 5, 5 + ui7_ctx->cm->tbh), R7Vec2(8, 240 - ui7_ctx->cm->tbh - 10))) {
// Check if and do nothing if the scrolling ofset goes out of screen
if (ui7_ctx->cm->scrolling_offset < ui7_ctx->cm->ms.y - 200 &&
ui7_ctx->cm->scrolling_offset > -40) {
@ -845,6 +846,7 @@ bool BeginMenu(const std::string &title, R7Vec2 size, UI7MenuFlags flags) {
}
}
}
}
// Update Start pos
ui7_ctx->cm->mdp = np;
}