"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MouseClickToFocus = void 0;
const core_1 = require("@vived/core");
const MouseInput_1 = require("../../MouseInput");
const CenterSceneRootOnPixelPick_1 = require("../UC/CenterSceneRootOnPixelPick");
class MouseClickToFocus extends core_1.AppObjectController {
    get centerOnPixelUI() {
        return this.getCachedLocalComponent(CenterSceneRootOnPixelPick_1.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 = MouseInput_1.MouseInputEntity.get(this.appObjects);
        if (mouseInput) {
            mouseInput.registerController(this);
        }
        else {
            this.warn("Unable to find MouseInputEntity");
        }
    }
}
exports.MouseClickToFocus = MouseClickToFocus;
MouseClickToFocus.type = "MouseClickToFocus";
//# sourceMappingURL=MouseClickToFocus.js.map