import { AppObjectUC } from "@vived/core";
import { BaseAppState } from "../../BaseApp";
import { Selection } from "../Entities";
export class ClearSelectionUCHook extends AppObjectUC {
    get baseApp() {
        return this.getCachedSingleton(BaseAppState.type);
    }
    get selection() {
        return this.getCachedSingleton(Selection.type);
    }
    constructor(appObject) {
        super(appObject, ClearSelectionUCHook.type);
        this.onBaseAppChange = () => {
            if (!this.baseApp || !this.selection) {
                this.warn("Missing Components");
                return;
            }
            if (this.baseApp.isAuthoring === this.lastAuthoringState)
                return;
            this.selection.pressedObjectId = null;
            this.selection.hoveredObjectId = null;
            this.selection.selectedObjectId = null;
            this.lastAuthoringState = this.baseApp.isAuthoring;
        };
        this.baseApp?.addChangeObserver(this.onBaseAppChange);
    }
}
ClearSelectionUCHook.type = "ClearSelectionUCHook";
//# sourceMappingURL=ClearSelectionUCHook.js.map