"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const mobx_react_1 = require("mobx-react");
const React = require("react");
const PiLogging_1 = require("../../util/PiLogging");
const Styles_1 = require("./styles/Styles");
const PiComponent_1 = require("./PiComponent");
let ProjectionalEditor = class ProjectionalEditor extends React.Component {
    constructor(props) {
        super(props);
        this.inFocus = false;
        this.onFocus = () => {
            PiLogging_1.EVENT_LOG.info(this, "onFocus");
            this.inFocus = true;
        };
        this.onBlur = () => {
            PiLogging_1.EVENT_LOG.info(this, "onBlur");
            this.inFocus = false;
        };
    }
    render() {
        return (React.createElement("div", { className: Styles_1.STYLES.projectionalEditor, onBlur: this.onBlur, onFocus: this.onFocus },
            React.createElement(PiComponent_1.PiComponent, { editor: this.props.editor })));
    }
    role() {
        return !!this.props.editor.selectedBox ? this.props.editor.selectedBox.role : "no-box";
    }
    focuslost() {
        if (!this.inFocus) {
            this.props.editor.selectedBox = null;
        }
        this.inFocus = false;
    }
};
ProjectionalEditor = __decorate([
    mobx_react_1.observer,
    __metadata("design:paramtypes", [Object])
], ProjectionalEditor);
exports.ProjectionalEditor = ProjectionalEditor;
//# sourceMappingURL=ProjectionalEditor.js.map