import { AppObjectController } from "@vived/core";
import { StylusEntity, } from "../../Stylus/Entity/StylusEntity";
import { TrySubmitObjectPickUC } from "../UseCases/TrySubmitObjectPickUC";
export class StylusObjectPickSC extends AppObjectController {
    get stylus() {
        return this.getCachedSingleton(StylusEntity.type);
    }
    get trySubmitObjectPick() {
        return this.getCachedSingleton(TrySubmitObjectPickUC.type)?.tryWithRay;
    }
    constructor(appObject) {
        super(appObject, StylusObjectPickSC.type);
        this.onButtonClick = (button) => {
            if (!this.stylus || !this.trySubmitObjectPick)
                return;
            if (button !== 0)
                return;
            const pointerRay = this.stylus.pickRay;
            this.trySubmitObjectPick(pointerRay);
        };
        this.stylus?.registerController(this);
    }
}
StylusObjectPickSC.type = "StylusObjectPickSC";
//# sourceMappingURL=StylusObjectPickSC.js.map