From 8614a7cbcc9a2334c667586e0a9ba06dcf5f17f3 Mon Sep 17 00:00:00 2001 From: Anton P Date: Sun, 8 Dec 2024 12:48:57 +0200 Subject: [PATCH] Propagate mouse events to ListWidget children (#694) --- src/dlangui/widgets/lists.d | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/dlangui/widgets/lists.d b/src/dlangui/widgets/lists.d index 4cd7e095..77317c19 100644 --- a/src/dlangui/widgets/lists.d +++ b/src/dlangui/widgets/lists.d @@ -1349,7 +1349,8 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler { itemrc.right += rc.left - scrollOffset.x; itemrc.top += rc.top - scrollOffset.y; itemrc.bottom += rc.top - scrollOffset.y; - if (itemrc.isPointInside(Point(event.x, event.y))) { + auto point = Point(event.x, event.y); + if (itemrc.isPointInside(point)) { if (_adapter && _adapter.wantMouseEvents) { auto itemWidget = _adapter.itemWidget(i); if (itemWidget) { @@ -1358,6 +1359,12 @@ class ListWidget : WidgetGroup, OnScrollHandler, OnAdapterChangeHandler { if (event.action == MouseAction.Move && event.noModifiers && itemWidget.hasTooltip) { itemWidget.scheduleTooltip(200); } + foreach (j; 0 .. itemWidget.childCount) { + auto child = itemWidget.child(j); + if (child.isPointInside(point)) { + child.onMouseEvent(event); + } + } itemWidget.onMouseEvent(event); itemWidget.parent = oldParent; }