Skip to content

Commit

Permalink
Propagate mouse events to ListWidget children (#694)
Browse files Browse the repository at this point in the history
  • Loading branch information
whitebyte authored Dec 8, 2024
1 parent 12c6ade commit 8614a7c
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/dlangui/widgets/lists.d
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
}
Expand Down

0 comments on commit 8614a7c

Please sign in to comment.