diff --git a/packages/display/src/Container.ts b/packages/display/src/Container.ts index 802f6240f6..a23fa80c09 100644 --- a/packages/display/src/Container.ts +++ b/packages/display/src/Container.ts @@ -1,9 +1,11 @@ -import { MASK_TYPES, settings, utils } from '@pixi/core'; +import { MASK_TYPES, Matrix, settings, utils } from '@pixi/core'; import { DisplayObject } from './DisplayObject'; -import type { MaskData, Renderer, Matrix, Rectangle } from '@pixi/core'; +import type { MaskData, Renderer, Rectangle } from '@pixi/core'; import type { IDestroyOptions } from './DisplayObject'; +const tempMatrix = new Matrix(); + function sortChildren(a: DisplayObject, b: DisplayObject): number { if (a.zIndex === b.zIndex) @@ -561,6 +563,22 @@ export class Container extends DisplayO bounds = this.getBounds(true); } + // Prepend the transform that is appended to the projection matrix. + const projectionTransform = renderer.projection.transform; + + if (projectionTransform) + { + if (transform) + { + transform = tempMatrix.copyFrom(transform); + transform.prepend(projectionTransform); + } + else + { + transform = projectionTransform; + } + } + // Render the container if the source frame intersects the bounds. if (bounds && sourceFrame.intersects(bounds, transform)) {