|
17 | 17 |
|
18 | 18 | use crate::{ |
19 | 19 | AbsoluteLength, Action, AnyDrag, AnyElement, AnyTooltip, AnyView, App, Bounds, ClickEvent, |
20 | | - DispatchPhase, Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, Hitbox, |
21 | | - HitboxBehavior, HitboxId, InspectorElementId, IntoElement, IsZero, KeyContext, KeyDownEvent, |
22 | | - KeyUpEvent, KeyboardButton, KeyboardClickEvent, LayoutId, ModifiersChangedEvent, MouseButton, |
23 | | - MouseClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Overflow, ParentElement, Pixels, |
24 | | - Point, Render, ScrollWheelEvent, SharedString, Size, Style, StyleRefinement, Styled, Task, |
25 | | - TooltipId, Visibility, Window, WindowControlArea, point, px, size, |
| 20 | + DispatchPhase, Display, Element, ElementId, Entity, FocusHandle, Global, GlobalElementId, |
| 21 | + Hitbox, HitboxBehavior, HitboxId, InspectorElementId, IntoElement, IsZero, KeyContext, |
| 22 | + KeyDownEvent, KeyUpEvent, KeyboardButton, KeyboardClickEvent, LayoutId, ModifiersChangedEvent, |
| 23 | + MouseButton, MouseClickEvent, MouseDownEvent, MouseMoveEvent, MouseUpEvent, Overflow, |
| 24 | + ParentElement, Pixels, Point, Render, ScrollWheelEvent, SharedString, Size, Style, |
| 25 | + StyleRefinement, Styled, Task, TooltipId, Visibility, Window, WindowControlArea, point, px, |
| 26 | + size, |
26 | 27 | }; |
27 | 28 | use collections::HashMap; |
28 | 29 | use refineable::Refineable; |
@@ -1403,7 +1404,12 @@ impl Element for Div { |
1403 | 1404 | content_size, |
1404 | 1405 | window, |
1405 | 1406 | cx, |
1406 | | - |_style, scroll_offset, hitbox, window, cx| { |
| 1407 | + |style, scroll_offset, hitbox, window, cx| { |
| 1408 | + // skip children |
| 1409 | + if style.display == Display::None { |
| 1410 | + return hitbox; |
| 1411 | + } |
| 1412 | + |
1407 | 1413 | window.with_element_offset(scroll_offset, |window| { |
1408 | 1414 | for child in &mut self.children { |
1409 | 1415 | child.prepaint(window, cx); |
@@ -1443,7 +1449,12 @@ impl Element for Div { |
1443 | 1449 | hitbox.as_ref(), |
1444 | 1450 | window, |
1445 | 1451 | cx, |
1446 | | - |_style, window, cx| { |
| 1452 | + |style, window, cx| { |
| 1453 | + // skip children |
| 1454 | + if style.display == Display::None { |
| 1455 | + return; |
| 1456 | + } |
| 1457 | + |
1447 | 1458 | for child in &mut self.children { |
1448 | 1459 | child.paint(window, cx); |
1449 | 1460 | } |
|
0 commit comments