diff --git a/examples/tests/viewport-strictbounds.ts b/examples/tests/viewport-strictbounds.ts deleted file mode 100644 index f124dd83..00000000 --- a/examples/tests/viewport-strictbounds.ts +++ /dev/null @@ -1,93 +0,0 @@ -import type { ExampleSettings } from '../common/ExampleSettings.js'; - -export async function automation(settings: ExampleSettings) { - const page = await test(settings); - page(1); - await settings.snapshot(); - - page(2); - await settings.snapshot(); - - page(3); - await settings.snapshot(); -} - -export default async function test({ renderer, testRoot }: ExampleSettings) { - // Create a container node - const containerNode = renderer.createNode({ - x: 10, - y: 100, - w: 1000, - h: 600, - color: 0xff0000ff, // Red - parent: testRoot, - strictBounds: false, - }); - - const status = renderer.createTextNode({ - text: 'Strict Bound: ', - fontSize: 30, - x: 10, - y: 50, - parent: testRoot, - }); - - const amountOfNodes = 11; - const childNodeWidth = 1700 / amountOfNodes; - - // Create 11 child nodes - for (let i = 0; i < amountOfNodes; i++) { - const childNode = renderer.createNode({ - x: i * childNodeWidth + i * 100, - y: 100, - w: childNodeWidth, - h: 300, - color: 0x00ff00ff, // Green - parent: containerNode, - }); - - const nodeTest = renderer.createTextNode({ - x: 10, - y: 130, - text: `Node ${i}`, - color: 0x000000ff, - parent: childNode, - }); - } - - renderer.on('idle', () => { - status.text = 'Strict Bound: ' + String(containerNode.strictBounds); - }); - - window.onkeydown = (e) => { - if (e.key === 'ArrowRight') { - containerNode.x -= 100; - } - - if (e.key === 'ArrowLeft') { - containerNode.x += 100; - } - - if (e.key === ' ') { - containerNode.strictBounds = !containerNode.strictBounds; - } - }; - - const page = (i = 0) => { - switch (i) { - case 1: - containerNode.x = -590; - break; - - case 2: - containerNode.x = -1390; - break; - - case 3: - containerNode.strictBounds = true; - break; - } - }; - - return page; -} diff --git a/src/core/CoreNode.test.ts b/src/core/CoreNode.test.ts index 5d3f9206..902966f8 100644 --- a/src/core/CoreNode.test.ts +++ b/src/core/CoreNode.test.ts @@ -62,7 +62,6 @@ describe('set color()', () => { y: 0, zIndex: 0, zIndexLocked: 0, - strictBounds: false, }; const clippingRect = { diff --git a/src/core/CoreNode.ts b/src/core/CoreNode.ts index ca5eba9b..220d3edd 100644 --- a/src/core/CoreNode.ts +++ b/src/core/CoreNode.ts @@ -672,21 +672,6 @@ export interface CoreNodeProps { * @default false */ interactive?: boolean; - /** - * By enabling Strict bounds the renderer will not process & render child nodes of a node that is out of the visible area - * - * @remarks - * When enabled out of bound nodes, i.e. nodes that are out of the visible area, will - * **NOT** have their children processed and renderer anymore. This means the children of a out of bound - * node will not receive update processing such as positioning updates and will not be drawn on screen. - * As such the rest of the branch of the update tree that sits below this node will not be processed anymore - * - * This is a big performance gain but may be disabled in cases where the width of the parent node is - * unknown and the render must process the child nodes regardless of the viewport status of the parent node - * - * @default true - */ - strictBounds: boolean; } /** @@ -796,7 +781,6 @@ export class CoreNode extends EventEmitter { p.mountY = props.mountY; p.mount = props.mount; p.pivot = props.pivot; - p.strictBounds = props.strictBounds; p.zIndex = props.zIndex; p.zIndexLocked = props.zIndexLocked; @@ -1219,10 +1203,7 @@ export class CoreNode extends EventEmitter { parent.setUpdateType(UpdateType.ZIndexSortedChildren); } - if ( - props.strictBounds === true && - this.renderState === CoreNodeRenderState.OutOfBounds - ) { + if (this.renderState === CoreNodeRenderState.OutOfBounds) { updateType &= ~UpdateType.RenderBounds; // remove render bounds update return; } @@ -2451,20 +2432,6 @@ export class CoreNode extends EventEmitter { this.parent?.setRTTUpdates(type); } - get strictBounds(): boolean { - return this.props.strictBounds; - } - - set strictBounds(v) { - if (v === this.props.strictBounds) { - return; - } - - this.props.strictBounds = v; - this.setUpdateType(UpdateType.RenderBounds | UpdateType.Children); - this.childUpdateType |= UpdateType.RenderBounds | UpdateType.Children; - } - animate( props: Partial, settings: Partial, diff --git a/src/core/Stage.ts b/src/core/Stage.ts index 0ceda96e..22916c90 100644 --- a/src/core/Stage.ts +++ b/src/core/Stage.ts @@ -102,7 +102,6 @@ export class Stage { public readonly defShaderNode: CoreShaderNode | null = null; public strictBound: Bound; public preloadBound: Bound; - public readonly strictBounds: boolean; public readonly defaultTexture: Texture | null = null; public pixelRatio: number; public readonly bufferMemory: number = 2e6; @@ -197,7 +196,6 @@ export class Stage { this.animationManager = new AnimationManager(); this.contextSpy = enableContextSpy ? new ContextSpy() : null; - this.strictBounds = options.strictBounds; let bm = [0, 0, 0, 0] as [number, number, number, number]; if (boundsMargin) { @@ -354,7 +352,6 @@ export class Stage { rtt: false, src: null, scale: 1, - strictBounds: this.strictBounds, }); this.root = rootNode; @@ -589,8 +586,7 @@ export class Stage { if ( child.worldAlpha === 0 || - (child.strictBounds === true && - child.renderState === CoreNodeRenderState.OutOfBounds) + child.renderState === CoreNodeRenderState.OutOfBounds ) { continue; } @@ -847,7 +843,6 @@ export class Stage { data, imageType: props.imageType, interactive: props.interactive ?? false, - strictBounds: props.strictBounds ?? this.strictBounds, }; } diff --git a/src/core/renderers/webgl/WebGlRenderer.ts b/src/core/renderers/webgl/WebGlRenderer.ts index 204b9092..729e783a 100644 --- a/src/core/renderers/webgl/WebGlRenderer.ts +++ b/src/core/renderers/webgl/WebGlRenderer.ts @@ -554,8 +554,7 @@ export class WebGlRenderer extends CoreRenderer { // Skip nodes that are not visible if ( node.worldAlpha === 0 || - (node.strictBounds === true && - node.renderState === CoreNodeRenderState.OutOfBounds) + node.renderState === CoreNodeRenderState.OutOfBounds ) { continue; } diff --git a/src/main-api/Renderer.ts b/src/main-api/Renderer.ts index 6cfa3172..b81d1f30 100644 --- a/src/main-api/Renderer.ts +++ b/src/main-api/Renderer.ts @@ -250,17 +250,6 @@ export type RendererMainSettings = RendererRuntimeSettings & { */ forceWebGL2: boolean; - /** - * Enable strictBounds - * - * @remarks - * Enable strict bounds for the renderer. This will ensure that the renderer - * will not render outside the bounds of the canvas. - * - * @defaultValue `true` - */ - strictBounds: boolean; - /** * Canvas object to use for rendering * @@ -400,7 +389,6 @@ export class RendererMain extends EventEmitter { renderEngine: settings.renderEngine, quadBufferSize: settings.quadBufferSize ?? 4 * 1024 * 1024, fontEngines: settings.fontEngines ?? [], - strictBounds: settings.strictBounds ?? true, textureProcessingTimeLimit: settings.textureProcessingTimeLimit || 42, canvas: settings.canvas || document.createElement('canvas'), createImageBitmapSupport: settings.createImageBitmapSupport || 'full', @@ -457,7 +445,6 @@ export class RendererMain extends EventEmitter { quadBufferSize: settings.quadBufferSize!, fontEngines: settings.fontEngines!, inspector: settings.inspector !== null, - strictBounds: settings.strictBounds!, targetFPS: settings.targetFPS!, textureProcessingTimeLimit: settings.textureProcessingTimeLimit!, createImageBitmapSupport: settings.createImageBitmapSupport!, diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-1.png b/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-1.png deleted file mode 100644 index 4a9d54d1..00000000 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-1.png and /dev/null differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-2.png b/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-2.png deleted file mode 100644 index 604bd0f0..00000000 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-2.png and /dev/null differ diff --git a/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-3.png b/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-3.png deleted file mode 100644 index 92518fff..00000000 Binary files a/visual-regression/certified-snapshots/chromium-ci/viewport-strictbounds-3.png and /dev/null differ