import { AppObjectController } from "@vived/core";
import { BaseAppState } from "../../BaseApp/Entity/BaseAppState";
import { MouseInputEntity, } from "../../MouseInput/Entities/MouseInput";
import { TrySelectObjectPickUC } from "../UseCases/TrySelectObjectPickUC";
import { TrySubmitObjectPickUC } from "../UseCases/TrySubmitObjectPickUC";
export class MouseObjectPickMC extends AppObjectController {
    get baseApp() {
        return this.getCachedSingleton(BaseAppState.type);
    }
    get mouseInput() {
        return this.getCachedSingleton(MouseInputEntity.type);
    }
    get trySelectObjectPick() {
        return this.getCachedSingleton(TrySelectObjectPickUC.type)?.tryWithPixel;
    }
    get trySubmitObjectPick() {
        return this.getCachedSingleton(TrySubmitObjectPickUC.type)?.tryWithPixel;
    }
    constructor(appObject) {
        super(appObject, MouseObjectPickMC.type);
        this.onClick = (e) => {
            if (!this.trySelectObjectPick || !this.trySubmitObjectPick)
                return;
            if (e.button !== 0) {
                return;
            }
            if (this.baseApp?.isAuthoring) {
                this.trySelectObjectPick(e.position);
            }
            else {
                this.trySubmitObjectPick(e.position);
            }
        };
        this.mouseInput?.registerController(this);
    }
}
MouseObjectPickMC.type = "MouseObjectPickMC";
//# sourceMappingURL=MouseObjectPickMC.js.map