mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-14 10:05:44 -04:00
Add some touch padding to the right of the inventory scrollbar
This way if you touch your finger a little bit to the right of the scrollbar, it still activates it instead of closing the inventory. (this was quite easy to do on accident)
This commit is contained in:
parent
cad713e6fe
commit
73a68dca39
@ -304,7 +304,7 @@ static int ScrollbarWidget_PointerDown(void* widget, int id, int x, int y) {
|
||||
int posY, height;
|
||||
|
||||
if (w->draggingId == id) return true;
|
||||
if (x < w->x || x >= w->x + w->width) return false;
|
||||
if (x < w->x || x >= w->x + w->width + w->padding) return false;
|
||||
/* only intercept pointer that's dragging scrollbar */
|
||||
if (w->draggingId) return false;
|
||||
|
||||
@ -378,6 +378,13 @@ void ScrollbarWidget_Create(struct ScrollbarWidget* w) {
|
||||
w->scrollingAcc = 0.0f;
|
||||
w->draggingId = 0;
|
||||
w->dragOffset = 0;
|
||||
|
||||
#ifdef CC_BUILD_TOUCH
|
||||
/* It's easy to accidentally touch a bit to the right of the */
|
||||
/* scrollbar with your finger, so just add some padding */
|
||||
if (!Input_TouchMode) return;
|
||||
w->padding = Display_ScaleX(15);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -54,7 +54,7 @@ struct ScrollbarWidget {
|
||||
int topRow, rowsTotal, rowsVisible;
|
||||
float scrollingAcc;
|
||||
int dragOffset;
|
||||
int draggingId;
|
||||
int draggingId, padding;
|
||||
int borderX, borderY;
|
||||
int nubsWidth, offsets[3];
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user