Skip to content

Commit

Permalink
Update code style
Browse files Browse the repository at this point in the history
  • Loading branch information
Temdog007 committed May 17, 2019
1 parent f04b450 commit 684eb5e
Showing 1 changed file with 29 additions and 26 deletions.
55 changes: 29 additions & 26 deletions editor/js/Sidebar.Geometry.ExtrudeGeometry.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,20 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {

var geometry = object.geometry;
var parameters = geometry.parameters;
var options = parameters.options;
options.curveSegments = options.curveSegments != undefined ? options.curveSegments : 12;
var options = parameters.options;
options.curveSegments = options.curveSegments != undefined ? options.curveSegments : 12;
options.steps = options.steps != undefined ? options.steps : 1;
options.depth = options.depth != undefined ? options.depth : 100;
options.bevelThickness =options.bevelThickness !== undefined ? options.bevelThickness : 6;
options.bevelSize = options.bevelSize !== undefined ? options.bevelSize : 4;
options.bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
options.bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3
options.bevelThickness = options.bevelThickness !== undefined ? options.bevelThickness : 6;
options.bevelSize = options.bevelSize !== undefined ? options.bevelSize : 4;
options.bevelOffset = options.bevelOffset !== undefined ? options.bevelOffset : 0;
options.bevelSegments = options.bevelSegments !== undefined ? options.bevelSegments : 3;


// curveSegments

var curveSegmentsRow = new UI.Row();
var curveSegments = new UI.Integer( options.curveSegments ).onChange( update ).setRange(1, Infinity);
var curveSegments = new UI.Integer( options.curveSegments ).onChange( update ).setRange( 1, Infinity );

curveSegmentsRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/curveSegments' ) ).setWidth( '90px' ) );
curveSegmentsRow.add( curveSegments );
Expand All @@ -35,7 +35,7 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {
// steps

var stepsRow = new UI.Row();
var steps = new UI.Integer( options.steps ).onChange( update ).setRange(1, Infinity);
var steps = new UI.Integer( options.steps ).onChange( update ).setRange( 1, Infinity );

stepsRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/steps' ) ).setWidth( '90px' ) );
stepsRow.add( steps );
Expand All @@ -45,7 +45,7 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {
// depth

var depthRow = new UI.Row();
var depth = new UI.Number( options.depth ).onChange( update ).setRange(1, Infinity);
var depth = new UI.Number( options.depth ).onChange( update ).setRange( 1, Infinity );

depthRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/depth' ) ).setWidth( '90px' ) );
depthRow.add( depth );
Expand All @@ -55,19 +55,19 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {
// enabled

var enabledRow = new UI.Row();
var enabled = new UI.Checkbox( options.bevelEnabled ).onChange( update );
var enabled = new UI.Checkbox( options.bevelEnabled ).onChange( update );

enabledRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelEnabled' ) ).setWidth( '90px' ) );
enabledRow.add( enabled );

container.add( enabledRow );

if(options.bevelEnabled === true){
if ( options.bevelEnabled === true ) {

// thickness

var thicknessRow = new UI.Row();
var thickness = new UI.Number( options.bevelThickness ).onChange( update );
var thickness = new UI.Number( options.bevelThickness ).onChange( update );

thicknessRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelThickness' ) ).setWidth( '90px' ) );
thicknessRow.add( thickness );
Expand All @@ -77,7 +77,7 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {
// size

var sizeRow = new UI.Row();
var size = new UI.Number( options.bevelSize ).onChange( update );
var size = new UI.Number( options.bevelSize ).onChange( update );

sizeRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelSize' ) ).setWidth( '90px' ) );
sizeRow.add( size );
Expand All @@ -87,7 +87,7 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {
// offset

var offsetRow = new UI.Row();
var offset = new UI.Number( options.bevelOffset ).onChange( update );
var offset = new UI.Number( options.bevelOffset ).onChange( update );

offsetRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelOffset' ) ).setWidth( '90px' ) );
offsetRow.add( offset );
Expand All @@ -97,16 +97,17 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {
// segments

var segmentsRow = new UI.Row();
var segments = new UI.Integer( options.bevelSegments ).onChange( update ).setRange(0, Infinity);
var segments = new UI.Integer( options.bevelSegments ).onChange( update ).setRange( 0, Infinity );

segmentsRow.add( new UI.Text( strings.getKey( 'sidebar/geometry/extrude_geometry/bevelSegments' ) ).setWidth( '90px' ) );
segmentsRow.add( segments );

container.add( segmentsRow );

}

var button = new UI.Button(strings.getKey( 'sidebar/geometry/extrude_geometry/shape' )).onClick(toShape).setWidth('90px').setMarginLeft('90px');
container.add(button);
var button = new UI.Button( strings.getKey( 'sidebar/geometry/extrude_geometry/shape' ) ).onClick( toShape ).setWidth( '90px' ).setMarginLeft( '90px' );
container.add( button );

//

Expand All @@ -115,24 +116,26 @@ Sidebar.Geometry.ExtrudeGeometry = function ( editor, object ) {
editor.execute( new SetGeometryCommand( object, new THREE[ geometry.type ](
parameters.shapes,
{
curveSegments : curveSegments.getValue(),
steps : steps.getValue(),
curveSegments: curveSegments.getValue(),
steps: steps.getValue(),
depth: depth.getValue(),
bevelEnabled : enabled.getValue(),
bevelThickness : thickness !== undefined ? thickness.getValue() : options.bevelThickness,
bevelSize : size !== undefined ? size.getValue() : options.bevelSize,
bevelOffset : offset !== undefined ? offset.getValue() : options.bevelOffset,
bevelSegments : segments !== undefined ? segments.getValue() : options.bevelSegments
bevelEnabled: enabled.getValue(),
bevelThickness: thickness !== undefined ? thickness.getValue() : options.bevelThickness,
bevelSize: size !== undefined ? size.getValue() : options.bevelSize,
bevelOffset: offset !== undefined ? offset.getValue() : options.bevelOffset,
bevelSegments: segments !== undefined ? segments.getValue() : options.bevelSegments
}
) ) );

}

function toShape() {

editor.execute( new SetGeometryCommand( object, new THREE.ShapeBufferGeometry(
parameters.shapes,
options.curveSegments
)));
) ) );

}

return container;
Expand Down

0 comments on commit 684eb5e

Please sign in to comment.