import { AppObjectController } from "@vived/core";
import { MouseInputEntity, } from "../../MouseInput/Entities/MouseInput";
import { TryAddCalloutUC } from "../UC/TryAddCallout";
export class MouseAddCalloutMC extends AppObjectController {
    get tryAddCalloutUc() {
        return this.getCachedSingleton(TryAddCalloutUC.type);
    }
    get mouseInput() {
        return this.getCachedSingleton(MouseInputEntity.type);
    }
    constructor(appObject) {
        super(appObject, MouseAddCalloutMC.type);
        this.isAdding = false;
        this.onDown = (e) => {
            this.isAdding = false;
            if (e.button !== 0)
                return;
            this.isAdding =
                this.tryAddCalloutUc?.initializeWithPixel(e.position) ?? false;
        };
        this.onMove = (e) => {
            if (!this.isAdding)
                return;
            this.tryAddCalloutUc?.moveWithPixel(e.position);
        };
        this.onUp = (e) => {
            if (!this.isAdding)
                return;
            this.tryAddCalloutUc?.stop();
            this.isAdding = false;
        };
        this.mouseInput?.registerController(this);
    }
}
MouseAddCalloutMC.type = "MouseAddCalloutMC";
//# sourceMappingURL=MouseAddCalloutMC.js.map