import { AppObjectController } from "@vived/core";
import { StylusEntity } from "../../Stylus";
import { StylusMoveTransformUC } from "../../Transform3D/UC/StylusMoveTransformUC";
export class SceneRootMoveSC extends AppObjectController {
    get stylus() {
        return this.getCachedSingleton(StylusEntity.type);
    }
    get stylusRootMovementUC() {
        return this.getCachedLocalComponent(StylusMoveTransformUC.type);
    }
    constructor(appObject) {
        super(appObject, SceneRootMoveSC.type);
        this.isMoving = false;
        this.allow = (button) => {
            if (button === 2)
                return true;
            return false;
        };
        this.onButtonDown = (button) => {
            this.isMoving = false;
            if (!this.stylus)
                return;
            if (!this.allow(button))
                return;
            this.stylusRootMovementUC?.initialize();
            this.isMoving = true;
        };
        this.onButtonUp = () => {
            this.isMoving = true;
            if (!this.stylus)
                return;
            this.stylusRootMovementUC?.stop();
        };
        this.onStylusMove = () => {
            if (!this.stylus || !this.isMoving)
                return;
            this.stylusRootMovementUC?.move();
        };
        this.stylus?.registerController(this);
    }
}
SceneRootMoveSC.type = "SceneRootMoveSC";
//# sourceMappingURL=SceneRootMoveSC.js.map