forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSidebar.Geometry.TetrahedronGeometry.js
56 lines (32 loc) · 1.26 KB
/
Sidebar.Geometry.TetrahedronGeometry.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import * as THREE from 'three';
import { UIDiv, UIRow, UIText, UIInteger, UINumber } from './libs/ui.js';
import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
function GeometryParametersPanel( editor, object ) {
const strings = editor.strings;
const signals = editor.signals;
const container = new UIDiv();
const geometry = object.geometry;
const parameters = geometry.parameters;
// radius
const radiusRow = new UIRow();
const radius = new UINumber( parameters.radius ).onChange( update );
radiusRow.add( new UIText( strings.getKey( 'sidebar/geometry/tetrahedron_geometry/radius' ) ).setClass( 'Label' ) );
radiusRow.add( radius );
container.add( radiusRow );
// detail
const detailRow = new UIRow();
const detail = new UIInteger( parameters.detail ).setRange( 0, Infinity ).onChange( update );
detailRow.add( new UIText( strings.getKey( 'sidebar/geometry/tetrahedron_geometry/detail' ) ).setClass( 'Label' ) );
detailRow.add( detail );
container.add( detailRow );
//
function update() {
editor.execute( new SetGeometryCommand( editor, object, new THREE.TetrahedronGeometry(
radius.getValue(),
detail.getValue()
) ) );
signals.objectChanged.dispatch( object );
}
return container;
}
export { GeometryParametersPanel };