import { c as FlowGraphEventBlock, _ as _IsDescendantOf } from './KHR_interactivity-VqtS29i9.esm.js';
import { f as RegisterClass } from './index-Cl9U4nB-.esm.js';
import { R as RichTypeAny, f as RichTypeNumber } from './declarationMapper-CZ6AxirO.esm.js';
import './objectModelMapping-ghOGfUOh.esm.js';

/**
 * A pointer move event block.
 * This block fires when the pointer moves.
 * Optionally filters to a specific mesh via the `targetMesh` input.
 */
class FlowGraphPointerMoveEventBlock extends FlowGraphEventBlock {
    /**
     * Creates a new FlowGraphPointerMoveEventBlock.
     * @param config optional configuration
     */
    constructor(config) {
        super(config);
        /** @internal */
        this.type = "PointerMove" /* FlowGraphEventType.PointerMove */;
        this.targetMesh = this.registerDataInput("targetMesh", RichTypeAny, config?.targetMesh);
        this.pointerId = this.registerDataOutput("pointerId", RichTypeNumber);
        this.meshUnderPointer = this.registerDataOutput("meshUnderPointer", RichTypeAny);
        this.pickedPoint = this.registerDataOutput("pickedPoint", RichTypeAny);
    }
    /** @internal */
    _executeEvent(context, pointerInfo) {
        const mesh = this.targetMesh.getValue(context);
        const pickedMesh = pointerInfo.pickInfo?.pickedMesh;
        // If a target mesh is set, only fire when that mesh (or a descendant) is under the pointer.
        if (mesh && !(pickedMesh === mesh || (pickedMesh && _IsDescendantOf(pickedMesh, mesh)))) {
            return true;
        }
        this.pointerId.setValue(pointerInfo.event.pointerId, context);
        this.meshUnderPointer.setValue(pickedMesh ?? null, context);
        this.pickedPoint.setValue(pointerInfo.pickInfo?.pickedPoint ?? null, context);
        this._execute(context);
        return !this.config?.stopPropagation;
    }
    /** @internal */
    _preparePendingTasks(_context) {
        // no-op
    }
    /** @internal */
    _cancelPendingTasks(_context) {
        // no-op
    }
    /**
     * @returns the class name of the block.
     */
    getClassName() {
        return "FlowGraphPointerMoveEventBlock" /* FlowGraphBlockNames.PointerMoveEvent */;
    }
}
RegisterClass("FlowGraphPointerMoveEventBlock" /* FlowGraphBlockNames.PointerMoveEvent */, FlowGraphPointerMoveEventBlock);

export { FlowGraphPointerMoveEventBlock };
//# sourceMappingURL=flowGraphPointerMoveEventBlock-jDZjPa2M.esm.js.map
