mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-16 19:17:57 +01:00
95 lines
2.2 KiB
JavaScript
Executable File
95 lines
2.2 KiB
JavaScript
Executable File
/**
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
|
|
Sidebar.Geometry.BoxGeometry = function ( signals, object ) {
|
|
|
|
var container = new UI.Panel();
|
|
|
|
var parameters = object.geometry.parameters;
|
|
|
|
// width
|
|
|
|
var widthRow = new UI.Panel();
|
|
var width = new UI.Number( parameters.width ).onChange( update );
|
|
|
|
widthRow.add( new UI.Text( 'Width' ).setWidth( '90px' ) );
|
|
widthRow.add( width );
|
|
|
|
container.add( widthRow );
|
|
|
|
// height
|
|
|
|
var heightRow = new UI.Panel();
|
|
var height = new UI.Number( parameters.height ).onChange( update );
|
|
|
|
heightRow.add( new UI.Text( 'Height' ).setWidth( '90px' ) );
|
|
heightRow.add( height );
|
|
|
|
container.add( heightRow );
|
|
|
|
// depth
|
|
|
|
var depthRow = new UI.Panel();
|
|
var depth = new UI.Number( parameters.depth ).onChange( update );
|
|
|
|
depthRow.add( new UI.Text( 'Depth' ).setWidth( '90px' ) );
|
|
depthRow.add( depth );
|
|
|
|
container.add( depthRow );
|
|
|
|
// widthSegments
|
|
|
|
var widthSegmentsRow = new UI.Panel();
|
|
var widthSegments = new UI.Integer( parameters.widthSegments ).setRange( 1, Infinity ).onChange( update );
|
|
|
|
widthSegmentsRow.add( new UI.Text( 'Width segments' ).setWidth( '90px' ) );
|
|
widthSegmentsRow.add( widthSegments );
|
|
|
|
container.add( widthSegmentsRow );
|
|
|
|
// heightSegments
|
|
|
|
var heightSegmentsRow = new UI.Panel();
|
|
var heightSegments = new UI.Integer( parameters.heightSegments ).setRange( 1, Infinity ).onChange( update );
|
|
|
|
heightSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
|
|
heightSegmentsRow.add( heightSegments );
|
|
|
|
container.add( heightSegmentsRow );
|
|
|
|
// depthSegments
|
|
|
|
var depthSegmentsRow = new UI.Panel();
|
|
var depthSegments = new UI.Integer( parameters.depthSegments ).setRange( 1, Infinity ).onChange( update );
|
|
|
|
depthSegmentsRow.add( new UI.Text( 'Height segments' ).setWidth( '90px' ) );
|
|
depthSegmentsRow.add( depthSegments );
|
|
|
|
container.add( depthSegmentsRow );
|
|
|
|
//
|
|
|
|
function update() {
|
|
|
|
object.geometry.dispose();
|
|
|
|
object.geometry = new THREE.BoxGeometry(
|
|
width.getValue(),
|
|
height.getValue(),
|
|
depth.getValue(),
|
|
widthSegments.getValue(),
|
|
heightSegments.getValue(),
|
|
depthSegments.getValue()
|
|
);
|
|
|
|
object.geometry.computeBoundingSphere();
|
|
|
|
signals.geometryChanged.dispatch( object );
|
|
|
|
}
|
|
|
|
return container;
|
|
|
|
}
|