mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-07-20 18:41:13 +08:00
Added anti drag feature to checkboxes
This commit is contained in:
parent
785bada114
commit
de686acd69
@ -70,17 +70,25 @@ class CheckboxBase : public ComponentBase, public CheckboxOption {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (event.mouse().button == Mouse::Left &&
|
if (event.mouse().button == Mouse::Left &&
|
||||||
event.mouse().motion == Mouse::Pressed) {
|
event.mouse().motion == Mouse::Pressed &&
|
||||||
|
isMousePressed == false) {
|
||||||
*checked = !*checked;
|
*checked = !*checked;
|
||||||
|
isMousePressed = true;
|
||||||
on_change();
|
on_change();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (event.mouse().button == Mouse::Left &&
|
||||||
|
event.mouse().motion == Mouse::Released) {
|
||||||
|
isMousePressed = false;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Focusable() const final { return true; }
|
bool Focusable() const final { return true; }
|
||||||
|
|
||||||
|
bool isMousePressed = false;
|
||||||
bool hovered_ = false;
|
bool hovered_ = false;
|
||||||
Box box_;
|
Box box_;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user