Easier to read HandleSelection

This commit is contained in:
Clement Roblot 2024-11-26 17:13:40 +07:00 committed by ArthurSonzogni
parent 5ecac2e8d6
commit 3d670e210d
No known key found for this signature in database
GPG Key ID: 41D98248C074CD6C

View File

@ -849,27 +849,21 @@ bool ScreenInteractive::HandleSelection(Event event) {
selection_box_.y_max = mouse.y;
return true;
}
if (!selection_pending_) {
return false;
}
if (mouse.motion == Mouse::Moved) {
else if((mouse.motion == Mouse::Moved) && (selection_pending_)) {
selection_box_.x_max = mouse.x;
selection_box_.y_max = mouse.y;
return true;
}
if (mouse.motion != Mouse::Released) {
return false;
}
else if((mouse.motion == Mouse::Released) && (selection_pending_)) {
selection_box_.x_max = mouse.x;
selection_box_.y_max = mouse.y;
selection_pending_ = nullptr;
return true;
}
return false;
}
// private
// NOLINTNEXTLINE
void ScreenInteractive::Draw(Component component) {