Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 0 additions & 112 deletions examples/tests/detect-touch.ts

This file was deleted.

24 changes: 1 addition & 23 deletions src/core/CoreNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -688,12 +688,6 @@ export interface CoreNodeProps {
* are provided. Only works when createImageBitmap is supported on the browser.
*/
srcY?: number;
/**
* Mark the node as interactive so we can perform hit tests on it
* when pointer events are registered.
* @default false
*/
interactive?: boolean;
/**
* preventDestroy flag prevents the node and its children from being destroyed
* when the parent is destroyed.
Expand Down Expand Up @@ -882,8 +876,7 @@ export class CoreNode extends EventEmitter {
// creates a fresh object with a consistent shape. Save fields that are
// re-applied through setters, then null them on props so the setters
// detect the change.
const { texture, shader, src, rtt, boundsMargin, interactive, parent } =
props;
const { texture, shader, src, rtt, boundsMargin, parent } = props;
const p = (this.props = props);
p.texture = null;
p.shader = null;
Expand Down Expand Up @@ -940,9 +933,6 @@ export class CoreNode extends EventEmitter {
if (boundsMargin !== null) {
this.boundsMargin = boundsMargin;
}
if (interactive !== undefined) {
this.interactive = interactive;
}

// Initialize autosize if enabled
if (p.autosize === true) {
Expand Down Expand Up @@ -2965,18 +2955,6 @@ export class CoreNode extends EventEmitter {
return this.props.textureOptions;
}

set interactive(value: boolean | undefined) {
this.props.interactive = value;
// Update Stage's interactive Set
if (value === true) {
this.stage.interactiveNodes.add(this);
}
}

get interactive(): boolean | undefined {
return this.props.interactive;
}

get componentName(): string | undefined {
return this.props.componentName;
}
Expand Down
47 changes: 0 additions & 47 deletions src/core/Stage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import {
import { CoreRenderer } from './renderers/CoreRenderer.js';
import { CoreTextNode, type CoreTextNodeProps } from './CoreTextNode.js';
import { santizeCustomDataMap } from '../main-api/utils.js';
import { pointInBound } from './lib/utils.js';
import type { CoreShaderNode } from './renderers/CoreShaderNode.js';
import { Matrix3d } from './lib/Matrix3d.js';
import { createBound, createPreloadBounds, type Bound } from './lib/utils.js';
Expand Down Expand Up @@ -71,11 +70,6 @@ export type StageFrameTickHandler = (
frameTickData: FrameTickPayload,
) => void;

export interface Point {
x: number;
y: number;
}

const autoStart = true;

export class Stage {
Expand All @@ -88,7 +82,6 @@ export class Stage {
public readonly shManager: CoreShaderManager;
public readonly renderer: CoreRenderer;
public readonly root: CoreNode;
public readonly interactiveNodes: Set<CoreNode> = new Set();
public boundsMargin: [number, number, number, number];
public readonly defShaderNode: CoreShaderNode | null = null;
public strictBound: Bound;
Expand Down Expand Up @@ -897,45 +890,6 @@ export class Stage {
this.root.childUpdateType |= UpdateType.RenderBounds;
}

/** Find all nodes at a given point
* @param data
*/
findNodesAtPoint(data: Point): CoreNode[] {
const x = data.x / this.options.deviceLogicalPixelRatio;
const y = data.y / this.options.deviceLogicalPixelRatio;
const nodes: CoreNode[] = [];
for (const node of this.interactiveNodes) {
if (node.isRenderable === false) {
continue;
}
if (pointInBound(x, y, node.renderBound!) === true) {
nodes.push(node);
}
}
return nodes;
}

/**
* Find the top node at a given point
* @param data
* @returns
*/
getNodeFromPosition(data: Point): CoreNode | null {
const nodes: CoreNode[] = this.findNodesAtPoint(data);
if (nodes.length === 0) {
return null;
}

//get last node in array (as top node)
let topNode = nodes[nodes.length - 1] as CoreNode;
for (let i = 0; i < nodes.length; i++) {
if (nodes[i]!.zIndex > topNode.zIndex) {
topNode = nodes[i]!;
}
}
return topNode || null;
}

/**
* add node to timeNodes arrays
* @param node
Expand Down Expand Up @@ -1062,7 +1016,6 @@ export class Stage {
rtt: props.rtt ?? false,
data,
imageType: props.imageType,
interactive: props.interactive ?? false,
preventDestroy: props.preventDestroy,
componentName: props.componentName,
componentLocation: props.componentLocation,
Expand Down
4 changes: 0 additions & 4 deletions src/core/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,10 +251,6 @@ export function boundLargeThanBound(bound1: Bound, bound2: Bound) {
);
}

export function pointInBound(x: number, y: number, bound: Bound) {
return !(x < bound.x1 || x > bound.x2 || y < bound.y1 || y > bound.y2);
}

export function isBoundPositive(bound: Bound): boolean {
return bound.x1 < bound.x2 && bound.y1 < bound.y2;
}
Expand Down
Loading