|
@@ -8,6 +8,7 @@ import { SetGeometryCommand } from './commands/SetGeometryCommand.js';
|
|
function GeometryParametersPanel( editor, object ) {
|
|
function GeometryParametersPanel( editor, object ) {
|
|
|
|
|
|
const strings = editor.strings;
|
|
const strings = editor.strings;
|
|
|
|
+ const signals = editor.signals;
|
|
|
|
|
|
const container = new UIDiv();
|
|
const container = new UIDiv();
|
|
|
|
|
|
@@ -27,7 +28,7 @@ function GeometryParametersPanel( editor, object ) {
|
|
// phiStart
|
|
// phiStart
|
|
|
|
|
|
const phiStartRow = new UIRow();
|
|
const phiStartRow = new UIRow();
|
|
- const phiStart = new UINumber( parameters.phiStart * 180 / Math.PI ).onChange( update );
|
|
|
|
|
|
+ const phiStart = new UINumber( parameters.phiStart * THREE.MathUtils.RAD2DEG ).onChange( update );
|
|
|
|
|
|
phiStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/phistart' ) ).setClass( 'Label' ) );
|
|
phiStartRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/phistart' ) ).setClass( 'Label' ) );
|
|
phiStartRow.add( phiStart );
|
|
phiStartRow.add( phiStart );
|
|
@@ -37,7 +38,7 @@ function GeometryParametersPanel( editor, object ) {
|
|
// phiLength
|
|
// phiLength
|
|
|
|
|
|
const phiLengthRow = new UIRow();
|
|
const phiLengthRow = new UIRow();
|
|
- const phiLength = new UINumber( parameters.phiLength * 180 / Math.PI ).onChange( update );
|
|
|
|
|
|
+ const phiLength = new UINumber( parameters.phiLength * THREE.MathUtils.RAD2DEG ).onChange( update );
|
|
|
|
|
|
phiLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/philength' ) ).setClass( 'Label' ) );
|
|
phiLengthRow.add( new UIText( strings.getKey( 'sidebar/geometry/lathe_geometry/philength' ) ).setClass( 'Label' ) );
|
|
phiLengthRow.add( phiLength );
|
|
phiLengthRow.add( phiLength );
|
|
@@ -54,13 +55,27 @@ function GeometryParametersPanel( editor, object ) {
|
|
|
|
|
|
container.add( pointsRow );
|
|
container.add( pointsRow );
|
|
|
|
|
|
|
|
+ //
|
|
|
|
+
|
|
|
|
+ function refreshUI() {
|
|
|
|
+
|
|
|
|
+ const parameters = object.geometry.parameters;
|
|
|
|
+
|
|
|
|
+ segments.setValue( parameters.segments );
|
|
|
|
+ phiStart.setValue( parameters.phiStart * THREE.MathUtils.RAD2DEG );
|
|
|
|
+ phiLength.setValue( parameters.phiLength * THREE.MathUtils.RAD2DEG );
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ signals.geometryChanged.add( refreshUI );
|
|
|
|
+
|
|
function update() {
|
|
function update() {
|
|
|
|
|
|
editor.execute( new SetGeometryCommand( editor, object, new THREE.LatheGeometry(
|
|
editor.execute( new SetGeometryCommand( editor, object, new THREE.LatheGeometry(
|
|
points.getValue(),
|
|
points.getValue(),
|
|
segments.getValue(),
|
|
segments.getValue(),
|
|
- phiStart.getValue() / 180 * Math.PI,
|
|
|
|
- phiLength.getValue() / 180 * Math.PI
|
|
|
|
|
|
+ phiStart.getValue() * THREE.MathUtils.DEG2RAD,
|
|
|
|
+ phiLength.getValue() * THREE.MathUtils.DEG2RAD
|
|
) ) );
|
|
) ) );
|
|
|
|
|
|
}
|
|
}
|