import { AppObjectController } from "@vived/core";
import { BaseAppState } from "../../BaseApp/Entity/BaseAppState";
import { TouchInputEntity, } from "../../TouchController/Entities/TouchInput";
import { TrySelectObjectPickUC } from "../UseCases/TrySelectObjectPickUC";
import { TrySubmitObjectPickUC } from "../UseCases/TrySubmitObjectPickUC";
export class TouchObjectPickTC extends AppObjectController {
    get baseApp() {
        return this.getCachedSingleton(BaseAppState.type);
    }
    get touchInput() {
        return this.getCachedSingleton(TouchInputEntity.type);
    }
    get trySelectObjectPick() {
        return this.getCachedSingleton(TrySelectObjectPickUC.type)?.tryWithPixel;
    }
    get trySubmitObjectPick() {
        return this.getCachedSingleton(TrySubmitObjectPickUC.type)?.tryWithPixel;
    }
    constructor(appObject) {
        super(appObject, TouchObjectPickTC.type);
        this.onTap = (e) => {
            if (!this.trySelectObjectPick || !this.trySubmitObjectPick)
                return;
            if (this.baseApp?.isAuthoring) {
                this.trySelectObjectPick(e.touchCenter);
            }
            else {
                this.trySubmitObjectPick(e.touchCenter);
            }
        };
        this.touchInput?.registerController(this);
    }
}
TouchObjectPickTC.type = "TouchObjectPickTC";
//# sourceMappingURL=TouchObjectPickTC.js.map