source: other-projects/playing-in-the-street/summer-2013/trunk/Playing-in-the-Street-WPF/Content/Web/mrdoob-three.js-4862f5f/editor/js/Toolbar.js@ 28897

Last change on this file since 28897 was 28897, checked in by davidb, 10 years ago

GUI front-end to server base plus web page content

File size: 1.2 KB
Line 
1var Toolbar = function ( editor ) {
2
3 var signals = editor.signals;
4
5 var container = new UI.Panel();
6
7 var buttons = new UI.Panel();
8 container.add( buttons );
9
10 // translate / rotate / scale
11
12 var translate = new UI.Button( 'translate' ).onClick( function () {
13
14 signals.transformModeChanged.dispatch( 'translate' );
15
16 } );
17 buttons.add( translate );
18
19 var rotate = new UI.Button( 'rotate' ).onClick( function () {
20
21 signals.transformModeChanged.dispatch( 'rotate' );
22
23 } );
24 buttons.add( rotate );
25
26 var scale = new UI.Button( 'scale' ).onClick( function () {
27
28 signals.transformModeChanged.dispatch( 'scale' );
29
30 } );
31 buttons.add( scale );
32
33 // grid
34
35 var grid = new UI.Number( 25 ).onChange( update );
36 grid.dom.style.width = '42px';
37 buttons.add( new UI.Text( 'Grid: ' ) );
38 buttons.add( grid );
39
40 var snap = new UI.Checkbox( false ).onChange( update );
41 buttons.add( snap );
42 buttons.add( new UI.Text( 'snap' ) );
43
44 var local = new UI.Checkbox( false ).onChange( update );
45 buttons.add( local );
46 buttons.add( new UI.Text( 'local' ) );
47
48 function update() {
49
50 signals.snapChanged.dispatch( snap.getValue() === true ? grid.getValue() : null );
51 signals.spaceChanged.dispatch( local.getValue() === true ? "local" : "world" );
52
53 }
54
55 update();
56
57 return container;
58
59}
Note: See TracBrowser for help on using the repository browser.