"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.StylusObjectPickSC = void 0;
const core_1 = require("@vived/core");
const StylusEntity_1 = require("../../Stylus/Entity/StylusEntity");
const TrySubmitObjectPickUC_1 = require("../UseCases/TrySubmitObjectPickUC");
class StylusObjectPickSC extends core_1.AppObjectController {
    get stylus() {
        return this.getCachedSingleton(StylusEntity_1.StylusEntity.type);
    }
    get trySubmitObjectPick() {
        return this.getCachedSingleton(TrySubmitObjectPickUC_1.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);
    }
}
exports.StylusObjectPickSC = StylusObjectPickSC;
StylusObjectPickSC.type = "StylusObjectPickSC";
//# sourceMappingURL=StylusObjectPickSC.js.map