import { Container, Point } from "pixi.js";
import { InteractionManager } from "../../interactions/InteractionManager";
/**
 * RoomTileLayer class that manage all the room tiles.
 *
 * @class
 * @memberof Scuti
 */
export class RoomTileLayer extends Container {
    /**
     * @param {Room} [room] - The room instance that we want to visualize.
     */
    constructor(room) {
        super();
        /**
         * The room tiles interaction manager.
         *
         * @member {InteractionManager}
         * @private
         */
        this._interactionManager = new InteractionManager();
        this._room = room;
    }
    /**
     * Return the tile or the stair at the specified screen position.
     *
     * @param {IPosition2D} [position] - The screen position.
     * @return {Tile | Stair}
     * @public
     */
    getTileFromGlobal(position) {
        const container = this.children.find((container) => {
            const point = new Point(position.x, position.y);
            if (container.hitArea.contains(container.toLocal(point).x, container.toLocal(point).y))
                return container;
        });
        return container;
    }
    /**
     * Reference to the pointer down event.
     *
     * @member {(event: IInteractionEvent) => void}
     * @readonly
     * @public
     */
    get onPointerDown() {
        return this._interactionManager.onPointerDown;
    }
    /**
     * Update the event function that will be executed.
     *
     * @param {(event: IInteractionEvent) => void} [value] - The event function that will be executed.
     * @public
     */
    set onPointerDown(value) {
        this._interactionManager.onPointerDown = value;
    }
    /**
     * Reference to the pointer up event.
     *
     * @member {(event: IInteractionEvent) => void}
     * @readonly
     * @public
     */
    get onPointerUp() {
        return this._interactionManager.onPointerUp;
    }
    /**
     * Update the event function that will be executed.
     *
     * @param {(event: IInteractionEvent) => void} [value] - The event function that will be executed.
     * @public
     */
    set onPointerUp(value) {
        this._interactionManager.onPointerUp = value;
    }
    /**
     * Reference to the pointer move event.
     *
     * @member {(event: IInteractionEvent) => void}
     * @readonly
     * @public
     */
    get onPointerMove() {
        return this._interactionManager.onPointerMove;
    }
    /**
     * Update the event function that will be executed.
     *
     * @param {(event: IInteractionEvent) => void} [value] - The event function that will be executed.
     * @public
     */
    set onPointerMove(value) {
        this._interactionManager.onPointerMove = value;
    }
    /**
     * Reference to the pointer out event.
     *
     * @member {(event: IInteractionEvent) => void}
     * @readonly
     * @public
     */
    get onPointerOut() {
        return this._interactionManager.onPointerOut;
    }
    /**
     * Update the event function that will be executed.
     *
     * @param {(event: IInteractionEvent) => void} [value] - The event function that will be executed.
     * @public
     */
    set onPointerOut(value) {
        this._interactionManager.onPointerOut = value;
    }
    /**
     * Reference to the pointer over event.
     *
     * @member {(event: IInteractionEvent) => void}
     * @readonly
     * @public
     */
    get onPointerOver() {
        return this._interactionManager.onPointerOver;
    }
    /**
     * Update the event function that will be executed.
     *
     * @param {(event: IInteractionEvent) => void} [value] - The event function that will be executed.
     * @public
     */
    set onPointerOver(value) {
        this._interactionManager.onPointerOver = value;
    }
    /**
     * Reference to the pointer double click event.
     *
     * @member {(event: IInteractionEvent) => void}
     * @readonly
     * @public
     */
    get onDoubleClick() {
        return this._interactionManager.onDoubleClick;
    }
    /**
     * Update the event function that will be executed.
     *
     * @param {(event: IInteractionEvent) => void} [value] - The event function that will be executed.
     * @public
     */
    set onDoubleClick(value) {
        this._interactionManager.onDoubleClick = value;
    }
}
//# sourceMappingURL=RoomTileLayer.js.map