mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 23:44:56 +01:00
68 lines
1.5 KiB
JavaScript
Executable File
68 lines
1.5 KiB
JavaScript
Executable File
/**
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
|
|
var Toolbar = function ( editor ) {
|
|
|
|
var signals = editor.signals;
|
|
|
|
var container = new UI.Panel();
|
|
container.setId( 'toolbar' );
|
|
|
|
var buttons = new UI.Panel();
|
|
container.add( buttons );
|
|
|
|
// translate / rotate / scale
|
|
|
|
var translate = new UI.Button( 'translate' ).onClick( function () {
|
|
|
|
signals.transformModeChanged.dispatch( 'translate' );
|
|
|
|
} );
|
|
buttons.add( translate );
|
|
|
|
var rotate = new UI.Button( 'rotate' ).onClick( function () {
|
|
|
|
signals.transformModeChanged.dispatch( 'rotate' );
|
|
|
|
} );
|
|
buttons.add( rotate );
|
|
|
|
var scale = new UI.Button( 'scale' ).onClick( function () {
|
|
|
|
signals.transformModeChanged.dispatch( 'scale' );
|
|
|
|
} );
|
|
buttons.add( scale );
|
|
|
|
// grid
|
|
|
|
var grid = new UI.Number( 25 ).onChange( update );
|
|
grid.dom.style.width = '42px';
|
|
buttons.add( new UI.Text( 'Grid: ' ) );
|
|
buttons.add( grid );
|
|
|
|
var snap = new UI.Checkbox( false ).onChange( update );
|
|
buttons.add( snap );
|
|
buttons.add( new UI.Text( 'snap' ) );
|
|
|
|
var local = new UI.Checkbox( false ).onChange( update );
|
|
buttons.add( local );
|
|
buttons.add( new UI.Text( 'local' ) );
|
|
|
|
var showGrid = new UI.Checkbox().onChange( update ).setValue( true );
|
|
buttons.add( showGrid );
|
|
buttons.add( new UI.Text( 'show' ) );
|
|
|
|
function update() {
|
|
|
|
signals.snapChanged.dispatch( snap.getValue() === true ? grid.getValue() : null );
|
|
signals.spaceChanged.dispatch( local.getValue() === true ? "local" : "world" );
|
|
signals.showGridChanged.dispatch( showGrid.getValue() );
|
|
|
|
}
|
|
|
|
return container;
|
|
|
|
}
|