"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Selectable = void 0;
exports.makeSelectable = makeSelectable;
const core_1 = require("@vived/core");
class Selectable extends core_1.AppObjectEntity {
    static get(appObj) {
        return appObj.getComponent(this.type);
    }
}
exports.Selectable = Selectable;
Selectable.type = "SELECTABLE_ENTITY";
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 core_1.MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedPressed = new core_1.MemoizedBoolean(false, this.notifyOnChange);
        this.memoizedSelected = new core_1.MemoizedBoolean(false, this.notifyOnChange);
    }
}
//# sourceMappingURL=Selectable.js.map