mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-12 11:25:04 +01:00
45 lines
1,007 B
JavaScript
45 lines
1,007 B
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import MenuHolder from '../menu/MenuHolder';
|
|
import {TOKENS as MENU_TOKENS} from '../menu/menuPlugin';
|
|
|
|
import WindowSystem from 'ui/WindowSystem';
|
|
import ActionInfo from '../actionInfo/ActionInfo';
|
|
|
|
export default class UISystem extends React.Component {
|
|
|
|
render() {
|
|
return <div {...this.props} onMouseDown={this.closeAllUpPopups} >
|
|
<MenuHolder />
|
|
<ActionInfo />
|
|
<WindowSystem />
|
|
{this.props.children}
|
|
</div>
|
|
}
|
|
|
|
shouldComponentUpdate() {
|
|
return false;
|
|
}
|
|
|
|
closeAllUpPopups = () => {
|
|
let openedMenus = this.context.bus.state[MENU_TOKENS.OPENED];
|
|
if (openedMenus && openedMenus.length !== 0) {
|
|
this.context.bus.dispatch(MENU_TOKENS.CLOSE_ALL);
|
|
}
|
|
};
|
|
|
|
getChildContext() {
|
|
return {
|
|
closeAllUpPopups: this.closeAllUpPopups
|
|
}
|
|
}
|
|
|
|
static contextTypes = {
|
|
bus: PropTypes.object
|
|
};
|
|
|
|
static childContextTypes = {
|
|
closeAllUpPopups: PropTypes.func
|
|
};
|
|
}
|
|
|