Revert GUI tap changes for now, as GUI doesnt work properly when program is lagging
This commit is contained in:
parent
057484e119
commit
9a1c2e516e
2 changed files with 7 additions and 7 deletions
|
|
@ -49,6 +49,7 @@ namespace GUIStuff {
|
|||
if(hovered) {
|
||||
held = true;
|
||||
clicked = true;
|
||||
selected = true;
|
||||
timeClicked = std::chrono::steady_clock::now();
|
||||
clickPos = cursorPos;
|
||||
}
|
||||
|
|
@ -56,10 +57,8 @@ namespace GUIStuff {
|
|||
selected = false;
|
||||
}
|
||||
else if(!isLeftHeld) {
|
||||
if(held && hovered && (std::chrono::steady_clock::now() - timeClicked) < std::chrono::milliseconds(250) && vec_distance_sqrd(clickPos, cursorPos) < (25 * 25)) {
|
||||
selected = true;
|
||||
if(held && hovered && (std::chrono::steady_clock::now() - timeClicked) < std::chrono::milliseconds(250) && vec_distance_sqrd(clickPos, cursorPos) < (25 * 25))
|
||||
tapped = true;
|
||||
}
|
||||
held = false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -334,14 +334,14 @@ bool GUIManager::radio_button(const char* id, bool val, const std::function<void
|
|||
RadioButton* e = insert_element<RadioButton>();
|
||||
e->update(*io, val, elemUpdate);
|
||||
pop_id();
|
||||
return e->selection.tapped;
|
||||
return e->selection.clicked;
|
||||
}
|
||||
|
||||
void GUIManager::checkbox(const char* id, bool* val, const std::function<void()>& elemUpdate) {
|
||||
push_id(id);
|
||||
CheckBox* e = insert_element<CheckBox>();
|
||||
e->update(*io, *val, elemUpdate);
|
||||
if(e->selection.tapped)
|
||||
if(e->selection.clicked)
|
||||
*val = !(*val);
|
||||
pop_id();
|
||||
}
|
||||
|
|
@ -431,7 +431,8 @@ bool GUIManager::selectable_button(const char* id, const std::function<void(Sele
|
|||
push_id(id);
|
||||
SelectableButton* e = insert_element<SelectableButton>();
|
||||
e->update(*io, drawType, elemUpdate, isSelected);
|
||||
bool toRet = onClick ? e->selection.clicked : e->selection.tapped;
|
||||
//bool toRet = onClick ? e->selection.clicked : e->selection.tapped;
|
||||
bool toRet = e->selection.clicked;
|
||||
pop_id();
|
||||
return toRet;
|
||||
}
|
||||
|
|
@ -856,7 +857,7 @@ bool GUIManager::rotate_wheel(const char* id, double* angle, float size, const s
|
|||
CLAY_AUTO_ID({.layout = {.sizing = {.width = CLAY_SIZING_FIXED(size), .height = CLAY_SIZING_FIXED(size) } } }) {
|
||||
RotateWheel* e = insert_element<RotateWheel>();
|
||||
e->update(*io, angle, elemUpdate);
|
||||
toRet = e->selection.tapped;
|
||||
toRet = e->selection.clicked;
|
||||
}
|
||||
pop_id();
|
||||
return toRet;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue