|
| 1 | +import { Point } from '..'; |
1 | 2 | import { Bounds } from '../scene/container/bounds/Bounds';
|
2 | 3 | import { getGlobalBounds } from '../scene/container/bounds/getGlobalBounds';
|
3 | 4 |
|
4 | 5 | import type { Container } from '../scene/container/Container';
|
5 | 6 |
|
6 | 7 | const tempBounds = new Bounds();
|
| 8 | +const tempPoint = new Point(); |
7 | 9 |
|
8 | 10 | /**
|
9 | 11 | * A rectangle-like object that contains x, y, width, and height properties.
|
@@ -96,7 +98,34 @@ export class Culler
|
96 | 98 | {
|
97 | 99 | if (container.cullable && container.measurable && container.includeInBuild)
|
98 | 100 | {
|
99 |
| - const bounds = container.cullArea ?? getGlobalBounds(container, skipUpdateTransform, tempBounds); |
| 101 | + let bounds = new Bounds(); |
| 102 | + |
| 103 | + if (container.cullArea) |
| 104 | + { |
| 105 | + const globalTL = container.toGlobal( |
| 106 | + { |
| 107 | + x: container.cullArea.x, |
| 108 | + y: container.cullArea.y |
| 109 | + }, |
| 110 | + tempPoint, |
| 111 | + skipUpdateTransform |
| 112 | + ); |
| 113 | + |
| 114 | + const globalBR = container.toGlobal( |
| 115 | + { |
| 116 | + x: container.cullArea.x + container.cullArea.width, |
| 117 | + y: container.cullArea.y + container.cullArea.height |
| 118 | + }, |
| 119 | + tempPoint, |
| 120 | + skipUpdateTransform |
| 121 | + ); |
| 122 | + |
| 123 | + bounds = new Bounds(globalTL.x, globalTL.y, globalBR.x, globalBR.y); |
| 124 | + } |
| 125 | + else |
| 126 | + { |
| 127 | + bounds = getGlobalBounds(container, skipUpdateTransform, tempBounds); |
| 128 | + } |
100 | 129 |
|
101 | 130 | // check view intersection..
|
102 | 131 | container.culled = bounds.x >= view.x + view.width
|
|
0 commit comments