import { AppObjectController } from "@vived/core";
import { MouseInputEntity, } from "../../MouseInput";
import { CenterSceneRootOnPixelPickUC } from "../UC/CenterSceneRootOnPixelPick";
export class MouseClickToFocus extends AppObjectController {
    get centerOnPixelUI() {
        return this.getCachedLocalComponent(CenterSceneRootOnPixelPickUC.type);
    }
    constructor(appObject) {
        super(appObject, MouseClickToFocus.type);
        this.allow = (e) => {
            if (e.button === 0) {
                return false;
            }
            return true;
        };
        this.onClick = (e) => {
            if (this.allow(e)) {
                this.centerOnPixelUI?.centerOnPixel(e.position);
            }
        };
        const mouseInput = MouseInputEntity.get(this.appObjects);
        if (mouseInput) {
            mouseInput.registerController(this);
        }
        else {
            this.warn("Unable to find MouseInputEntity");
        }
    }
}
MouseClickToFocus.type = "MouseClickToFocus";
//# sourceMappingURL=MouseClickToFocus.js.map