aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/platform/gui/osx/InputMethod.mm2
-rw-r--r--src/platform/gui/osx/InputMethodPrivate.h2
-rw-r--r--src/platform/gui/osx/Window.mm14
-rw-r--r--src/platform/gui/osx/WindowPrivate.h14
-rw-r--r--src/platform/gui/sdl/Window.cpp14
-rw-r--r--src/platform/gui/win/InputMethod.cpp2
-rw-r--r--src/platform/gui/win/TimerManager.h2
-rw-r--r--src/platform/gui/xcb/InputMethod.cpp2
-rw-r--r--src/platform/gui/xcb/Window.cpp14
-rw-r--r--src/ui/helper/ClickDetector.cpp8
-rw-r--r--src/ui/host/WindowHost.cpp6
-rw-r--r--src/ui/render/ScrollBar.cpp240
-rw-r--r--src/ui/render/ScrollRenderObject.cpp7
13 files changed, 150 insertions, 177 deletions
diff --git a/src/platform/gui/osx/InputMethod.mm b/src/platform/gui/osx/InputMethod.mm
index 10003a5d..11ba1ad6 100644
--- a/src/platform/gui/osx/InputMethod.mm
+++ b/src/platform/gui/osx/InputMethod.mm
@@ -78,7 +78,7 @@ IEvent<std::nullptr_t>* OsxInputMethodContext::CompositionEvent() {
return &p_->composition_event_;
}
-IEvent<std::string>* OsxInputMethodContext::TextEvent() { return &p_->text_event_; }
+IEvent<const std::string&>* OsxInputMethodContext::TextEvent() { return &p_->text_event_; }
bool OsxInputMethodContext::IsEnabled() { return p_->is_enabled_; }
}
diff --git a/src/platform/gui/osx/InputMethodPrivate.h b/src/platform/gui/osx/InputMethodPrivate.h
index 39f3be02..f5726205 100644
--- a/src/platform/gui/osx/InputMethodPrivate.h
+++ b/src/platform/gui/osx/InputMethodPrivate.h
@@ -56,7 +56,7 @@ class OsxInputMethodContextPrivate {
Event<std::nullptr_t> composition_start_event_;
Event<std::nullptr_t> composition_event_;
Event<std::nullptr_t> composition_end_event_;
- Event<std::string> text_event_;
+ Event<const std::string&> text_event_;
bool is_enabled_ = false;
};
diff --git a/src/platform/gui/osx/Window.mm b/src/platform/gui/osx/Window.mm
index 600f4902..5f655185 100644
--- a/src/platform/gui/osx/Window.mm
+++ b/src/platform/gui/osx/Window.mm
@@ -379,17 +379,17 @@ IEvent<std::nullptr_t>* OsxWindow::PaintEvent() { return &p_->paint_event_; }
IEvent<WindowVisibilityType>* OsxWindow::VisibilityChangeEvent() {
return &p_->visibility_change_event_;
}
-IEvent<Size>* OsxWindow::ResizeEvent() { return &p_->resize_event_; }
+IEvent<const Size&>* OsxWindow::ResizeEvent() { return &p_->resize_event_; }
IEvent<FocusChangeType>* OsxWindow::FocusEvent() { return &p_->focus_event_; }
IEvent<MouseEnterLeaveType>* OsxWindow::MouseEnterLeaveEvent() {
return &p_->mouse_enter_leave_event_;
}
-IEvent<Point>* OsxWindow::MouseMoveEvent() { return &p_->mouse_move_event_; }
-IEvent<NativeMouseButtonEventArgs>* OsxWindow::MouseDownEvent() { return &p_->mouse_down_event_; }
-IEvent<NativeMouseButtonEventArgs>* OsxWindow::MouseUpEvent() { return &p_->mouse_up_event_; }
-IEvent<NativeMouseWheelEventArgs>* OsxWindow::MouseWheelEvent() { return &p_->mouse_wheel_event_; }
-IEvent<NativeKeyEventArgs>* OsxWindow::KeyDownEvent() { return &p_->key_down_event_; }
-IEvent<NativeKeyEventArgs>* OsxWindow::KeyUpEvent() { return &p_->key_up_event_; }
+IEvent<const Point&>* OsxWindow::MouseMoveEvent() { return &p_->mouse_move_event_; }
+IEvent<const NativeMouseButtonEventArgs&>* OsxWindow::MouseDownEvent() { return &p_->mouse_down_event_; }
+IEvent<const NativeMouseButtonEventArgs&>* OsxWindow::MouseUpEvent() { return &p_->mouse_up_event_; }
+IEvent<const NativeMouseWheelEventArgs&>* OsxWindow::MouseWheelEvent() { return &p_->mouse_wheel_event_; }
+IEvent<const NativeKeyEventArgs&>* OsxWindow::KeyDownEvent() { return &p_->key_down_event_; }
+IEvent<const NativeKeyEventArgs&>* OsxWindow::KeyUpEvent() { return &p_->key_up_event_; }
IInputMethodContext* OsxWindow::GetInputMethodContext() { return p_->input_method_context_.get(); }
} // namespace cru::platform::gui::osx
diff --git a/src/platform/gui/osx/WindowPrivate.h b/src/platform/gui/osx/WindowPrivate.h
index 913f2b2b..94b7e948 100644
--- a/src/platform/gui/osx/WindowPrivate.h
+++ b/src/platform/gui/osx/WindowPrivate.h
@@ -103,15 +103,15 @@ class OsxWindowPrivate {
Event<std::nullptr_t> destroy_event_;
Event<std::nullptr_t> paint_event_;
Event<WindowVisibilityType> visibility_change_event_;
- Event<Size> resize_event_;
+ Event<const Size&> resize_event_;
Event<FocusChangeType> focus_event_;
Event<MouseEnterLeaveType> mouse_enter_leave_event_;
- Event<Point> mouse_move_event_;
- Event<NativeMouseButtonEventArgs> mouse_down_event_;
- Event<NativeMouseButtonEventArgs> mouse_up_event_;
- Event<NativeMouseWheelEventArgs> mouse_wheel_event_;
- Event<NativeKeyEventArgs> key_down_event_;
- Event<NativeKeyEventArgs> key_up_event_;
+ Event<const Point&> mouse_move_event_;
+ Event<const NativeMouseButtonEventArgs&> mouse_down_event_;
+ Event<const NativeMouseButtonEventArgs&> mouse_up_event_;
+ Event<const NativeMouseWheelEventArgs&> mouse_wheel_event_;
+ Event<const NativeKeyEventArgs&> key_down_event_;
+ Event<const NativeKeyEventArgs&> key_up_event_;
};
} // namespace details
} // namespace cru::platform::gui::osx
diff --git a/src/platform/gui/sdl/Window.cpp b/src/platform/gui/sdl/Window.cpp
index 1c2d53bc..e0898cb1 100644
--- a/src/platform/gui/sdl/Window.cpp
+++ b/src/platform/gui/sdl/Window.cpp
@@ -132,7 +132,7 @@ IEvent<WindowVisibilityType> *SdlWindow::VisibilityChangeEvent() {
return &visibility_change_event_;
}
-IEvent<Size> *SdlWindow::ResizeEvent() { return &resize_event_; }
+IEvent<const Size&> *SdlWindow::ResizeEvent() { return &resize_event_; }
IEvent<FocusChangeType> *SdlWindow::FocusEvent() { return &focus_event_; }
@@ -140,25 +140,25 @@ IEvent<MouseEnterLeaveType> *SdlWindow::MouseEnterLeaveEvent() {
return &mouse_enter_leave_event_;
}
-IEvent<Point> *SdlWindow::MouseMoveEvent() { return &mouse_move_event_; }
+IEvent<const Point&> *SdlWindow::MouseMoveEvent() { return &mouse_move_event_; }
-IEvent<NativeMouseButtonEventArgs> *SdlWindow::MouseDownEvent() {
+IEvent<const NativeMouseButtonEventArgs&> *SdlWindow::MouseDownEvent() {
return &mouse_down_event_;
}
-IEvent<NativeMouseButtonEventArgs> *SdlWindow::MouseUpEvent() {
+IEvent<const NativeMouseButtonEventArgs&> *SdlWindow::MouseUpEvent() {
return &mouse_up_event_;
}
-IEvent<NativeMouseWheelEventArgs> *SdlWindow::MouseWheelEvent() {
+IEvent<const NativeMouseWheelEventArgs&> *SdlWindow::MouseWheelEvent() {
return &mouse_wheel_event_;
}
-IEvent<NativeKeyEventArgs> *SdlWindow::KeyDownEvent() {
+IEvent<const NativeKeyEventArgs&> *SdlWindow::KeyDownEvent() {
return &key_down_event_;
}
-IEvent<NativeKeyEventArgs> *SdlWindow::KeyUpEvent() { return &key_up_event_; }
+IEvent<const NativeKeyEventArgs&> *SdlWindow::KeyUpEvent() { return &key_up_event_; }
IInputMethodContext *SdlWindow::GetInputMethodContext() { NotImplemented(); }
diff --git a/src/platform/gui/win/InputMethod.cpp b/src/platform/gui/win/InputMethod.cpp
index e5b75cdb..1d7e2629 100644
--- a/src/platform/gui/win/InputMethod.cpp
+++ b/src/platform/gui/win/InputMethod.cpp
@@ -230,7 +230,7 @@ IEvent<std::nullptr_t>* WinInputMethodContext::CompositionEvent() {
return &composition_event_;
}
-IEvent<std::string>* WinInputMethodContext::TextEvent() { return &text_event_; }
+IEvent<const std::string&>* WinInputMethodContext::TextEvent() { return &text_event_; }
void WinInputMethodContext::OnWindowNativeMessage(
WindowNativeMessageEventArgs& args) {
diff --git a/src/platform/gui/win/TimerManager.h b/src/platform/gui/win/TimerManager.h
index d5a07f7f..9b049310 100644
--- a/src/platform/gui/win/TimerManager.h
+++ b/src/platform/gui/win/TimerManager.h
@@ -46,7 +46,7 @@ class TimerManager : public Object {
private:
GodWindow* god_window_;
- EventRevokerListGuard event_guard_;
+ EventHandlerRevokerListGuard event_guard_;
long long next_id_ = 1;
std::unordered_map<long long, TimerInfo> info_map_;
diff --git a/src/platform/gui/xcb/InputMethod.cpp b/src/platform/gui/xcb/InputMethod.cpp
index d6d4b9e7..96d04348 100644
--- a/src/platform/gui/xcb/InputMethod.cpp
+++ b/src/platform/gui/xcb/InputMethod.cpp
@@ -204,7 +204,7 @@ IEvent<std::nullptr_t> *XcbXimInputMethodContext::CompositionEvent() {
return &composition_event_;
}
-IEvent<std::string> *XcbXimInputMethodContext::TextEvent() {
+IEvent<const std::string&> *XcbXimInputMethodContext::TextEvent() {
return &text_event_;
}
diff --git a/src/platform/gui/xcb/Window.cpp b/src/platform/gui/xcb/Window.cpp
index 96483e04..44db5af3 100644
--- a/src/platform/gui/xcb/Window.cpp
+++ b/src/platform/gui/xcb/Window.cpp
@@ -311,7 +311,7 @@ IEvent<WindowVisibilityType> *XcbWindow::VisibilityChangeEvent() {
return &visibility_change_event_;
}
-IEvent<Size> *XcbWindow::ResizeEvent() { return &resize_event_; }
+IEvent<const Size&> *XcbWindow::ResizeEvent() { return &resize_event_; }
IEvent<FocusChangeType> *XcbWindow::FocusEvent() { return &focus_event_; }
@@ -319,25 +319,25 @@ IEvent<MouseEnterLeaveType> *XcbWindow::MouseEnterLeaveEvent() {
return &mouse_enter_leave_event_;
}
-IEvent<Point> *XcbWindow::MouseMoveEvent() { return &mouse_move_event_; }
+IEvent<const Point&> *XcbWindow::MouseMoveEvent() { return &mouse_move_event_; }
-IEvent<NativeMouseButtonEventArgs> *XcbWindow::MouseDownEvent() {
+IEvent<const NativeMouseButtonEventArgs&> *XcbWindow::MouseDownEvent() {
return &mouse_down_event_;
}
-IEvent<NativeMouseButtonEventArgs> *XcbWindow::MouseUpEvent() {
+IEvent<const NativeMouseButtonEventArgs&> *XcbWindow::MouseUpEvent() {
return &mouse_up_event_;
}
-IEvent<NativeMouseWheelEventArgs> *XcbWindow::MouseWheelEvent() {
+IEvent<const NativeMouseWheelEventArgs&> *XcbWindow::MouseWheelEvent() {
return &mouse_wheel_event_;
}
-IEvent<NativeKeyEventArgs> *XcbWindow::KeyDownEvent() {
+IEvent<const NativeKeyEventArgs&> *XcbWindow::KeyDownEvent() {
return &key_down_event_;
}
-IEvent<NativeKeyEventArgs> *XcbWindow::KeyUpEvent() { return &key_up_event_; }
+IEvent<const NativeKeyEventArgs&> *XcbWindow::KeyUpEvent() { return &key_up_event_; }
IInputMethodContext *XcbWindow::GetInputMethodContext() {
return input_method_;
diff --git a/src/ui/helper/ClickDetector.cpp b/src/ui/helper/ClickDetector.cpp
index 21caff35..cf219db0 100644
--- a/src/ui/helper/ClickDetector.cpp
+++ b/src/ui/helper/ClickDetector.cpp
@@ -23,7 +23,7 @@ ClickDetector::ClickDetector(controls::Control* control) {
control_ = control;
event_rovoker_guards_.push_back(
- EventRevokerGuard(control->MouseEnterEvent()->Direct()->AddHandler(
+ EventHandlerRevokerGuard(control->MouseEnterEvent()->Direct()->AddHandler(
[this](events::MouseEventArgs&) {
if (this->enable_) {
if (this->state_ == ClickState::PressInactive) {
@@ -37,7 +37,7 @@ ClickDetector::ClickDetector(controls::Control* control) {
})));
event_rovoker_guards_.push_back(
- EventRevokerGuard(control->MouseLeaveEvent()->Direct()->AddHandler(
+ EventHandlerRevokerGuard(control->MouseLeaveEvent()->Direct()->AddHandler(
[this](events::MouseEventArgs&) {
if (this->enable_) {
if (this->state_ == ClickState::Press) {
@@ -51,7 +51,7 @@ ClickDetector::ClickDetector(controls::Control* control) {
})));
event_rovoker_guards_.push_back(
- EventRevokerGuard(control->MouseDownEvent()->Direct()->AddHandler(
+ EventHandlerRevokerGuard(control->MouseDownEvent()->Direct()->AddHandler(
[this](events::MouseButtonEventArgs& args) {
const auto button = args.GetButton();
if (this->enable_ && (button & this->trigger_button_) &&
@@ -70,7 +70,7 @@ ClickDetector::ClickDetector(controls::Control* control) {
})));
event_rovoker_guards_.push_back(
- EventRevokerGuard(control->MouseUpEvent()->Direct()->AddHandler(
+ EventHandlerRevokerGuard(control->MouseUpEvent()->Direct()->AddHandler(
[this](events::MouseButtonEventArgs& args) {
const auto button = args.GetButton();
if (this->enable_ && (button & this->trigger_button_) &&
diff --git a/src/ui/host/WindowHost.cpp b/src/ui/host/WindowHost.cpp
index 4c707772..7417740d 100644
--- a/src/ui/host/WindowHost.cpp
+++ b/src/ui/host/WindowHost.cpp
@@ -93,9 +93,9 @@ namespace {
template <typename T>
inline void BindNativeEvent(
WindowHost* host, INativeWindow* native_window, IEvent<T>* event,
- void (WindowHost::*handler)(INativeWindow*, typename IEvent<T>::EventArgs),
- std::vector<EventRevokerGuard>& guard_pool) {
- guard_pool.push_back(EventRevokerGuard(event->AddHandler(
+ void (WindowHost::*handler)(INativeWindow*, typename IEvent<T>::Args),
+ std::vector<EventHandlerRevokerGuard>& guard_pool) {
+ guard_pool.push_back(EventHandlerRevokerGuard(event->AddHandler(
std::bind(handler, host, native_window, std::placeholders::_1))));
}
} // namespace
diff --git a/src/ui/render/ScrollBar.cpp b/src/ui/render/ScrollBar.cpp
index a3bee22c..804395e4 100644
--- a/src/ui/render/ScrollBar.cpp
+++ b/src/ui/render/ScrollBar.cpp
@@ -115,143 +115,121 @@ void ScrollBar::Draw(platform::graphics::IPainter* painter) {
void ScrollBar::InstallHandlers(controls::Control* control) {
event_guard_.Clear();
if (control != nullptr) {
- event_guard_ +=
- control->MouseDownEvent()->Tunnel()->PrependShortCircuitHandler(
- [control, this](events::MouseButtonEventArgs& event) {
- if (event.GetButton() == MouseButtons::Left && IsEnabled() &&
- IsExpanded()) {
- auto hit_test_result =
- ExpandedHitTest(event.GetPoint(render_object_));
- if (!hit_test_result) return false;
-
- if (mouse_press_ != hit_test_result) {
- mouse_press_ = hit_test_result;
- render_object_->InvalidatePaint();
- }
-
- switch (*hit_test_result) {
- case ScrollBarAreaKind::UpArrow:
- this->scroll_attempt_event_.Raise(
- {GetDirection(), ScrollKind::Line, -1});
- event.SetHandled();
- return true;
- case ScrollBarAreaKind::DownArrow:
- this->scroll_attempt_event_.Raise(
- {GetDirection(), ScrollKind::Line, 1});
- event.SetHandled();
- return true;
- case ScrollBarAreaKind::UpSlot:
- this->scroll_attempt_event_.Raise(
- {GetDirection(), ScrollKind::Page, -1});
- event.SetHandled();
- return true;
- case ScrollBarAreaKind::DownSlot:
- this->scroll_attempt_event_.Raise(
- {GetDirection(), ScrollKind::Page, 1});
- event.SetHandled();
- return true;
- case ScrollBarAreaKind::Thumb: {
- auto thumb_rect =
- GetExpandedAreaRect(ScrollBarAreaKind::Thumb);
- assert(thumb_rect);
-
- if (!control->CaptureMouse()) break;
- move_thumb_thumb_original_rect_ = *thumb_rect;
- move_thumb_start_ = event.GetPoint();
- event.SetHandled();
- return true;
- }
- default:
- break;
- }
- }
-
- return false;
- });
-
- event_guard_ +=
- control->MouseUpEvent()->Tunnel()->PrependShortCircuitHandler(
- [control, this](events::MouseButtonEventArgs& event) {
- if (mouse_press_ != std::nullopt) {
- mouse_press_ = std::nullopt;
- render_object_->InvalidatePaint();
- }
-
- if (event.GetButton() == MouseButtons::Left &&
- move_thumb_start_) {
- move_thumb_start_ = std::nullopt;
-
- auto hit_test_result =
- ExpandedHitTest(event.GetPoint(this->render_object_));
- if (!hit_test_result) {
- OnMouseLeave();
- }
-
- control->ReleaseMouse();
+ event_guard_ += control->MouseDownEvent()->Tunnel()->AddHandler(
+ [control, this](events::MouseButtonEventArgs& event) {
+ if (event.GetButton() == MouseButtons::Left && IsEnabled() &&
+ IsExpanded()) {
+ auto hit_test_result =
+ ExpandedHitTest(event.GetPoint(render_object_));
+ if (!hit_test_result) return;
+
+ if (mouse_press_ != hit_test_result) {
+ mouse_press_ = hit_test_result;
+ render_object_->InvalidatePaint();
+ }
+
+ switch (*hit_test_result) {
+ case ScrollBarAreaKind::UpArrow:
+ this->scroll_attempt_event_.Raise(
+ {GetDirection(), ScrollKind::Line, -1});
event.SetHandled();
- return true;
- }
- return false;
- });
-
- event_guard_ +=
- control->MouseMoveEvent()->Tunnel()->PrependShortCircuitHandler(
- [this](events::MouseEventArgs& event) {
- if (move_thumb_start_) {
- auto new_scroll_position = CalculateNewScrollPosition(
- move_thumb_thumb_original_rect_,
- event.GetPoint() - *move_thumb_start_);
-
- this->scroll_attempt_event_.Raise({GetDirection(),
- ScrollKind::Absolute,
- new_scroll_position});
+ case ScrollBarAreaKind::DownArrow:
+ this->scroll_attempt_event_.Raise(
+ {GetDirection(), ScrollKind::Line, 1});
event.SetHandled();
- return true;
- }
+ case ScrollBarAreaKind::UpSlot:
+ this->scroll_attempt_event_.Raise(
+ {GetDirection(), ScrollKind::Page, -1});
+ event.SetHandled();
+ case ScrollBarAreaKind::DownSlot:
+ this->scroll_attempt_event_.Raise(
+ {GetDirection(), ScrollKind::Page, 1});
+ event.SetHandled();
+ case ScrollBarAreaKind::Thumb: {
+ auto thumb_rect = GetExpandedAreaRect(ScrollBarAreaKind::Thumb);
+ assert(thumb_rect);
- if (IsEnabled()) {
- if (IsExpanded()) {
- auto hit_test_result =
- ExpandedHitTest(event.GetPoint(this->render_object_));
- if (mouse_hover_ != hit_test_result) {
- mouse_hover_ = hit_test_result;
- render_object_->InvalidatePaint();
- }
- if (hit_test_result) {
- SetCursor();
- StopAutoCollapseTimer();
- } else {
- OnMouseLeave();
- }
- } else {
- auto trigger_expand_area =
- GetCollapsedTriggerExpandAreaRect();
- if (trigger_expand_area &&
- trigger_expand_area->IsPointInside(
- event.GetPoint(this->render_object_))) {
- SetExpanded(true);
- SetCursor();
- event.SetHandled();
- return true;
- }
- }
+ if (!control->CaptureMouse()) break;
+ move_thumb_thumb_original_rect_ = *thumb_rect;
+ move_thumb_start_ = event.GetPoint();
+ event.SetHandled();
}
-
- return false;
- });
-
- event_guard_ +=
- control->MouseLeaveEvent()->Tunnel()->PrependShortCircuitHandler(
- [this](events::MouseEventArgs&) {
- if (IsExpanded() && !move_thumb_start_) {
- if (mouse_hover_ != std::nullopt) {
- mouse_hover_ = std::nullopt;
- render_object_->InvalidatePaint();
- }
+ default:
+ break;
+ }
+ }
+ });
+
+ event_guard_ += control->MouseUpEvent()->Tunnel()->AddHandler(
+ [control, this](events::MouseButtonEventArgs& event) {
+ if (mouse_press_ != std::nullopt) {
+ mouse_press_ = std::nullopt;
+ render_object_->InvalidatePaint();
+ }
+
+ if (event.GetButton() == MouseButtons::Left && move_thumb_start_) {
+ move_thumb_start_ = std::nullopt;
+
+ auto hit_test_result =
+ ExpandedHitTest(event.GetPoint(this->render_object_));
+ if (!hit_test_result) {
+ OnMouseLeave();
+ }
+
+ control->ReleaseMouse();
+ event.SetHandled();
+ }
+ });
+
+ event_guard_ += control->MouseMoveEvent()->Tunnel()->AddHandler(
+ [this](events::MouseEventArgs& event) {
+ if (move_thumb_start_) {
+ auto new_scroll_position = CalculateNewScrollPosition(
+ move_thumb_thumb_original_rect_,
+ event.GetPoint() - *move_thumb_start_);
+
+ this->scroll_attempt_event_.Raise(
+ {GetDirection(), ScrollKind::Absolute, new_scroll_position});
+ event.SetHandled();
+ }
+
+ if (IsEnabled()) {
+ if (IsExpanded()) {
+ auto hit_test_result =
+ ExpandedHitTest(event.GetPoint(this->render_object_));
+ if (mouse_hover_ != hit_test_result) {
+ mouse_hover_ = hit_test_result;
+ render_object_->InvalidatePaint();
+ }
+ if (hit_test_result) {
+ SetCursor();
+ StopAutoCollapseTimer();
+ } else {
OnMouseLeave();
}
- return false;
- });
+ } else {
+ auto trigger_expand_area = GetCollapsedTriggerExpandAreaRect();
+ if (trigger_expand_area &&
+ trigger_expand_area->IsPointInside(
+ event.GetPoint(this->render_object_))) {
+ SetExpanded(true);
+ SetCursor();
+ event.SetHandled();
+ }
+ }
+ }
+ });
+
+ event_guard_ += control->MouseLeaveEvent()->Tunnel()->AddHandler(
+ [this](events::MouseEventArgs&) {
+ if (IsExpanded() && !move_thumb_start_) {
+ if (mouse_hover_ != std::nullopt) {
+ mouse_hover_ = std::nullopt;
+ render_object_->InvalidatePaint();
+ }
+ OnMouseLeave();
+ }
+ });
}
}
diff --git a/src/ui/render/ScrollRenderObject.cpp b/src/ui/render/ScrollRenderObject.cpp
index b8b6904d..ea93dd21 100644
--- a/src/ui/render/ScrollRenderObject.cpp
+++ b/src/ui/render/ScrollRenderObject.cpp
@@ -218,7 +218,7 @@ void ScrollRenderObject::InstallMouseWheelHandler(controls::Control* control) {
guard_.Clear();
if (control != nullptr) {
- guard_ += control->MouseWheelEvent()->Bubble()->PrependShortCircuitHandler(
+ guard_ += control->MouseWheelEvent()->Bubble()->AddHandler(
[this](events::MouseWheelEventArgs& args) {
auto delta = args.GetDelta();
@@ -228,24 +228,19 @@ void ScrollRenderObject::InstallMouseWheelHandler(controls::Control* control) {
if (VerticalCanScrollDown()) {
ApplyScroll(
Scroll{Direction::Vertical, ScrollKind::Relative, delta});
- return true;
} else if (HorizontalCanScrollDown()) {
ApplyScroll(
Scroll{Direction::Horizontal, ScrollKind::Relative, delta});
- return true;
}
} else if (delta < 0) {
if (VerticalCanScrollUp()) {
ApplyScroll(
Scroll{Direction::Vertical, ScrollKind::Relative, delta});
- return true;
} else if (HorizontalCanScrollUp()) {
ApplyScroll(
Scroll{Direction::Horizontal, ScrollKind::Relative, delta});
- return true;
}
}
- return false;
});
}
}