* Layout self and subviews. * * Implementations should call `setNeedsDisplay` if a draw is required. * * The default implementation uses `this.layouter` to lay out subviews. * * Can be overwritten by subclasses that wish to manually manage their * subviews' layout. * * NOT
()
| 237 | * @see displayIfNeeded |
| 238 | */ |
| 239 | layoutSubviews() { |
| 240 | const {frame, _layouter, subviews, visibleArea} = this; |
| 241 | const existingLayout = viewsToLayout(subviews); |
| 242 | const newLayout = _layouter(existingLayout, frame); |
| 243 | collapseLayoutIntoViews(newLayout); |
| 244 | |
| 245 | subviews.forEach((subview, subviewIndex) => { |
| 246 | if (rectIntersectsRect(visibleArea, subview.frame)) { |
| 247 | subview.setVisibleArea(intersectionOfRects(visibleArea, subview.frame)); |
| 248 | } else { |
| 249 | subview.setVisibleArea(zeroRect); |
| 250 | } |
| 251 | }); |
| 252 | } |
| 253 | |
| 254 | /** |
| 255 | * Draw the contents of this view in the given canvas `context`. |
no test coverage detected