import { AppObjectController } from "@vived/core";
import { StylusEntity } from "../../Stylus";
import { HoverAppObjectUC } from "../UC/HoverAppObjectUC";
export class StylusHoverOnAppObjectSC extends AppObjectController {
    constructor(appObject) {
        super(appObject, StylusHoverOnAppObjectSC.type);
        this.allow = () => {
            return true;
        };
        this.onStylusMove = () => {
            if (!this.stylus)
                return;
            if (!this.hoverUC)
                return;
            if (!this.allow())
                return;
            const pointerRay = this.stylus.pickRay;
            this.hoverUC.tryHoverAppObject(pointerRay);
        };
        this.stylus = StylusEntity.get(this.appObjects);
        if (!this.stylus) {
            this.warn("Unable to find StylusEntity");
            return;
        }
        this.hoverUC = appObject.getComponent(HoverAppObjectUC.type);
        if (!this.stylus) {
            console.warn("StylusInputPointer Controller has been added to an app object that does not have a ZSpaceStylusEntity");
        }
        else if (!this.hoverUC) {
            console.warn("HoverAppObjectUC has not been found on any objects in the app object repo");
        }
        else {
            this.stylus.registerController(this);
        }
    }
}
StylusHoverOnAppObjectSC.type = "StylusHoverOnAppObjectSC";
//# sourceMappingURL=StylusHoverOnAppObjectSC.js.map