import { AppObjectController } from "@vived/core";
import { StylusEntity, } from "../../Stylus/Entity/StylusEntity";
import { LabelDropRepo } from "../Entities/LabelDropRepo";
import { DragLabelDropWorldUC } from "../UseCases/DragLabelDropWorldUC";
export class StylusLabelDrop extends AppObjectController {
}
StylusLabelDrop.type = "StylusLabelDrop";
export function makeStylusLabelDrop(appObject) {
    return new StylusLabelDropImp(appObject);
}
class StylusLabelDropImp extends StylusLabelDrop {
    get stylus() {
        return this.getCachedSingleton(StylusEntity.type);
    }
    constructor(appObject) {
        super(appObject, StylusLabelDrop.type);
        this.onButtonDown = (button) => { };
        this.onStylusMove = () => {
            if (!this.stylus)
                return;
            if (!this.labelDropEntity)
                return;
            if (!this.labelDropEntity.draggingID)
                return;
            if (!this.dragLabelDropWorldUC)
                return;
            this.dragLabelDropWorldUC.updateDrag(this.stylus.pickRay);
        };
        this.onButtonUp = (button) => {
            if (!this.stylus)
                return;
            if (!this.labelDropEntity)
                return;
            if (!this.labelDropEntity.draggingID)
                return;
            if (!this.dragLabelDropWorldUC)
                return;
            this.dragLabelDropWorldUC.releaseDrag(this.stylus.pickRay);
        };
        this.labelDropEntity = LabelDropRepo.get(this.appObjects);
        if (!this.labelDropEntity) {
            this.error("[StylusLabelDrop] unable to find LabelDropEntity");
            return;
        }
        this.dragLabelDropWorldUC = DragLabelDropWorldUC.get(this.appObjects);
        if (!this.dragLabelDropWorldUC) {
            this.error("[StylusLabelDrop] unable to find DragLabelDropWorldUC");
            return;
        }
        if (!this.stylus) {
            this.error("[StylusLabelDrop] unable to find ZSpaceStylusEntity");
            return;
        }
        this.stylus.registerController(this);
    }
}
//# sourceMappingURL=StylusLabelDrop.js.map