awv3
Version:
⚡ AWV3 embedded CAD
141 lines (125 loc) • 4.06 kB
JavaScript
import _extends from "@babel/runtime/helpers/extends";
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
var _dec, _class;
import React from 'react';
import { connect } from 'react-redux';
import Plugin from '../../session/plugin';
import { actions } from '../../session/store/globals';
import BoundingBoxInfo from '../boundingBoxInfo/';
var Root = (_dec = connect(function (_ref) {
var globals = _ref.globals;
return {
camera: globals.camera,
day: globals.day,
colors: globals.colors
};
}, {
setCamera: actions.setCamera,
setColorMode: actions.setColorMode
}), _dec(_class =
/*#__PURE__*/
function (_React$Component) {
_inheritsLoose(Root, _React$Component);
function Root() {
var _temp, _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return (_temp = _this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this, Object.defineProperty(_assertThisInitialized(_this), "state", {
configurable: true,
enumerable: true,
writable: true,
value: {
bounds: false
}
}), Object.defineProperty(_assertThisInitialized(_this), "setCamera", {
configurable: true,
enumerable: true,
writable: true,
value: function value() {
return _this.props.setCamera(_this.props.camera === 'orthographic' ? 'perspective' : 'orthographic');
}
}), Object.defineProperty(_assertThisInitialized(_this), "setColorMode", {
configurable: true,
enumerable: true,
writable: true,
value: function value() {
return _this.props.setColorMode(!_this.props.day);
}
}), Object.defineProperty(_assertThisInitialized(_this), "setBounds", {
configurable: true,
enumerable: true,
writable: true,
value: function value() {
return _this.setState(function (state) {
return {
bounds: !state.bounds
};
}, _this.props.toggleBounds);
}
}), _temp) || _assertThisInitialized(_this);
}
var _proto = Root.prototype;
_proto.render = function render() {
return React.createElement("group", {
format: "Table"
}, React.createElement("checkbox", {
name: "Orthographic",
value: this.props.camera === 'orthographic',
onValue: this.setCamera
}), React.createElement("checkbox", {
name: "Daylight",
value: this.props.day,
onValue: this.setColorMode
}), React.createElement("checkbox", {
name: "Show bounds",
value: this.props.bounds,
onValue: this.setBounds
}));
};
return Root;
}(React.Component)) || _class);
var Options =
/*#__PURE__*/
function (_Plugin) {
_inheritsLoose(Options, _Plugin);
function Options(session, args) {
var _this2;
_this2 = _Plugin.call(this, session, _extends({
type: 'Options',
icon: 'isometric',
resources: {
isometric: require('!!url-loader!awv3-icons/32x32/isometric.png')
}
}, args)) || this;
Object.defineProperty(_assertThisInitialized(_this2), "toggleBounds", {
configurable: true,
enumerable: true,
writable: true,
value: function value() {
if (_this2.boundingBox === undefined) {
var pool = _this2.session.pool;
pool.updateBounds();
_this2.boundingBox = new BoundingBoxInfo(_this2.session, {
fsrtPoint: pool.bounds.box.min,
scndPoint: pool.bounds.box.max
});
_this2.boundingBox.enabled = true;
} else {
_this2.boundingBox.destroy();
_this2.boundingBox = undefined;
}
}
});
return _this2;
}
var _proto2 = Options.prototype;
_proto2.render = function render() {
return React.createElement(Root, {
toggleBounds: this.toggleBounds
});
};
return Options;
}(Plugin);
export { Options as default };