"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZSpaceStylusHoverLabel = void 0;
exports.makeStylusHoverLabelController = makeStylusHoverLabelController;
const core_1 = require("@vived/core");
const Stylus_1 = require("../../Stylus");
const UseCases_1 = require("../UseCases");
class ZSpaceStylusHoverLabel extends core_1.AppObjectController {
}
exports.ZSpaceStylusHoverLabel = ZSpaceStylusHoverLabel;
ZSpaceStylusHoverLabel.type = "StylusHoverLabelController";
function makeStylusHoverLabelController(appObject) {
    return new ZSpaceStylusHoverLabelImp(appObject);
}
class ZSpaceStylusHoverLabelImp extends ZSpaceStylusHoverLabel {
    constructor(appObject) {
        super(appObject, ZSpaceStylusHoverLabel.type);
        this.allow = () => {
            return true;
        };
        this.onStylusMove = () => {
            if (!this.stylus) {
                return;
            }
            if (!this.allow()) {
                return;
            }
            this.tryShowStylusHoverLabel?.tryShowWorldHoverLabel(this.stylus.pickRay);
        };
        this.stylus = Stylus_1.StylusEntity.get(this.appObjects);
        this.tryShowStylusHoverLabel = UseCases_1.TryShowHoverLabel.get(this.appObjects);
        if (!this.stylus) {
            this.error("Cannot find StylusEntity");
        }
        else if (!this.tryShowStylusHoverLabel) {
            this.error("Cannot find TryShowHoverLabel");
        }
        else {
            this.stylus.registerController(this);
        }
    }
}
//# sourceMappingURL=StylusHoverLabel.js.map