Fixing UI bugs, some clean up
This commit is contained in:
1 parent
1d8e103690
commit
1c20333f30
18 files changed
+37
-26
No files matched your search
+3
-1
@@ -1253,7 +1253,7 @@ namespace FRG {
|
||||
bool UiManager::setButtonCallback(const std::string& name, std::function<void(const std::string&)> cb) {
|
||||
auto b = findButton(name);
|
||||
if (!b) {
|
||||
std::cerr << "UiManager: setButtonCallback failed, button not found: " << name << std::endl;
|
||||
logger() << "UiManager: setButtonCallback failed, button not found: " << name << std::endl;
|
||||
return false;
|
||||
}
|
||||
b->onClick = std::move(cb);
|
||||
@@ -1850,11 +1850,13 @@ namespace FRG {
|
||||
for (auto it = allInteractives.rbegin(); it != allInteractives.rend(); ++it) {
|
||||
if (std::holds_alternative<std::shared_ptr<UiButton>>(*it)) {
|
||||
auto& b = std::get<std::shared_ptr<UiButton>>(*it);
|
||||
//logger() << "onTouchDown found the button: " << b->name << std::endl;
|
||||
if (b->state != ButtonState::Disabled &&
|
||||
b->getClickZoneRect().containsConsideringBorder((float)x, (float)y, b->border)) {
|
||||
b->state = ButtonState::Pressed;
|
||||
pressedButtons[fingerId] = b;
|
||||
if (b->onPress) b->onPress(b->name);
|
||||
//logger() << "onTouchDown pressed the button: " << b->name << std::endl;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user