diff options
author | crupest <crupest@outlook.com> | 2022-03-11 22:38:41 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-03-11 22:38:41 +0800 |
commit | c6d05af374ef11cec4a550eb63c73abdb2cd5f72 (patch) | |
tree | b6161cbd8de2498f2d3870d490eec014990101cf /src/ui/helper | |
parent | 3d74364e78fadbc0b36081097e4a3a22a8ee26f2 (diff) | |
download | cru-c6d05af374ef11cec4a550eb63c73abdb2cd5f72.tar.gz cru-c6d05af374ef11cec4a550eb63c73abdb2cd5f72.tar.bz2 cru-c6d05af374ef11cec4a550eb63c73abdb2cd5f72.zip |
...
Diffstat (limited to 'src/ui/helper')
-rw-r--r-- | src/ui/helper/ClickDetector.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/ui/helper/ClickDetector.cpp b/src/ui/helper/ClickDetector.cpp index 8ebdfabc..f76f8af4 100644 --- a/src/ui/helper/ClickDetector.cpp +++ b/src/ui/helper/ClickDetector.cpp @@ -58,8 +58,7 @@ ClickDetector::ClickDetector(controls::Control* control) { this->state_ == ClickState::Hover) { if (!this->control_->CaptureMouse()) { if constexpr (debug_flags::click_detector) { - CRU_LOG_DEBUG( - u"Failed to capture mouse when begin click."); + CRU_LOG_DEBUG(u"Failed to capture mouse when begin click."); } return; } @@ -77,10 +76,12 @@ ClickDetector::ClickDetector(controls::Control* control) { button == button_) { if (this->state_ == ClickState::Press) { this->SetState(ClickState::Hover); + auto resolver = this->control_->CreateResolver(); this->event_.Raise(ClickEventArgs{this->control_, this->down_point_, args.GetPoint(), button}); - this->control_->ReleaseMouse(); + auto c = resolver.Resolve(); + if (c) c->ReleaseMouse(); } else if (this->state_ == ClickState::PressInactive) { this->SetState(ClickState::None); this->control_->ReleaseMouse(); @@ -136,8 +137,7 @@ void ClickDetector::SetState(ClickState state) { UnreachableCode(); } }; - CRU_LOG_DEBUG(u"Click state changed, new state: {}.", - to_string(state)); + CRU_LOG_DEBUG(u"Click state changed, new state: {}.", to_string(state)); } state_ = state; |