1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- /**
- * @author Temdog007 / http://github.com/Temdog007
- */
- import * as THREE from '../../build/three.module.js';
- import { UIRow, UIText, UIInteger, UIButton } from './libs/ui.js';
- import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
- var SidebarGeometryShapeGeometry = function ( editor, object ) {
- var strings = editor.strings;
- var container = new UIRow();
- var geometry = object.geometry;
- var parameters = geometry.parameters;
- // curveSegments
- var curveSegmentsRow = new UIRow();
- var curveSegments = new UIInteger( parameters.curveSegments || 12 ).onChange( changeShape ).setRange( 1, Infinity );
- curveSegmentsRow.add( new UIText( strings.getKey( 'sidebar/geometry/shape_geometry/curveSegments' ) ).setWidth( '90px' ) );
- curveSegmentsRow.add( curveSegments );
- container.add( curveSegmentsRow );
- // to extrude
- var button = new UIButton( strings.getKey( 'sidebar/geometry/shape_geometry/extrude' ) ).onClick( toExtrude ).setWidth( '90px' ).setMarginLeft( '90px' );
- container.add( button );
- //
- function changeShape() {
- editor.execute( new SetGeometryCommand( editor, object, new THREE.ShapeBufferGeometry(
- parameters.shapes,
- curveSegments.getValue()
- ) ) );
- }
- function toExtrude() {
- editor.execute( new SetGeometryCommand( editor, object, new THREE.ExtrudeBufferGeometry(
- parameters.shapes, {
- curveSegments: curveSegments.getValue()
- }
- ) ) );
- }
- return container;
- };
- export { SidebarGeometryShapeGeometry };
|