import { AppObjectEntity, MemoizedBoolean } from "@vived/core";
export class Selectable extends AppObjectEntity {
    static get(appObj) {
        return appObj.getComponent(this.type);
    }
}
Selectable.type = "SELECTABLE_ENTITY";
export function makeSelectable(appObj) {
    return new SelectableImp(appObj);
}
class SelectableImp extends Selectable {
    dispose() {
        super.dispose();
        if (this.inSelection) {
            this.inSelection.removeSelectable(this);
        }
    }
    get hovered() {
        return this.memoizedHovered.val;
    }
    set hovered(val) {
        this.memoizedHovered.val = val;
    }
    get pressed() {
        return this.memoizedPressed.val;
    }
    set pressed(val) {
        this.memoizedPressed.val = val;
    }
    get selected() {
        return this.memoizedSelected.val;
    }
    set selected(val) {
        this.memoizedSelected.val = val;
    }
    constructor(appObject) {
        super(appObject, Selectable.type);
        this.memoizedHovered = new MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedPressed = new MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedSelected = new MemoizedBoolean(false, this.notifyOnChange);
    }
}
//# sourceMappingURL=Selectable.js.map