UNPKG

meta-client

Version:
1 lines 1.28 kB
'use strict';Object.defineProperty(exports,'__esModule',{value:true});var _three=require('three');var _Graphics=require('../Graphics');var _Graphics2=_interopRequireDefault(_Graphics);var _Space=require('../../../Space');var _Space2=_interopRequireDefault(_Space);function _interopRequireDefault(obj){return obj&&obj.__esModule?obj:{default:obj}}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError('Cannot call a class as a function')}}var _DEFAULT={TOP:0,BOTTOM:0.25,HEIGHT:1,SEGMENTS:32,SCALE:1};var Cylinder=function Cylinder(){var props=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var stop=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;_classCallCheck(this,Cylinder);if(typeof props==='boolean')stop=props;var scale=_DEFAULT.SCALE;var _top=props.t||props.top||_DEFAULT.TOP;var _bottom=props.b||props.bottom||_DEFAULT.BOTTOM;var _height=props.h||props.height||_DEFAULT.HEIGHT;if(typeof props==='number')_top=_bottom=props/2;if(typeof props==='number')_height=props;_top*=scale;_bottom*=scale;_height*=scale;this.geometry=new _three.CylinderGeometry(_top,_bottom,_height,_DEFAULT.SEGMENTS);this.type='cylinder';return stop?this.geometry:new _Graphics2.default(this)};exports.default=Cylinder;