UNPKG

awv3

Version:
47 lines (36 loc) 1.57 kB
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose"; import * as THREE from 'three'; import BaseGraphics from './base'; var Radial = /*#__PURE__*/ function (_BaseGraphics) { _inheritsLoose(Radial, _BaseGraphics); function Radial() { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } return _BaseGraphics.call.apply(_BaseGraphics, [this].concat(args, [2, 0, 1])) || this; } var _proto = Radial.prototype; _proto.updateFromState = function updateFromState(info) { var _BaseGraphics$prototy; var _map = ['center', 'dimPt'].map(function (x) { return new THREE.Vector3().fromArray(info.dimension.members[x].value); }), center = _map[0], dim = _map[1]; var radius = info.dimension.members.radius.value; var end = dim.clone().sub(center).setLength(radius).add(center); var outside = dim.distanceTo(center) > end.distanceTo(center); var dir = end.clone().sub(center).normalize(); this.updateLine(0, center, end); this.updateLine(1, center, dim); this.updateArrow(0, end, dir.clone().multiplyScalar(outside ? -1 : 1)); for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) { args[_key2 - 1] = arguments[_key2]; } (_BaseGraphics$prototy = _BaseGraphics.prototype.updateFromState).call.apply(_BaseGraphics$prototy, [this, info].concat(args)); }; return Radial; }(BaseGraphics); export { Radial as default };