Sidebar.Settings.Viewport.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Settings.Viewport = function ( editor ) {
  5. var signals = editor.signals;
  6. var strings = editor.strings;
  7. var config = editor.config;
  8. var container = new UI.Div();
  9. container.add( new UI.Break() );
  10. container.add( new UI.Text( strings.getKey( 'sidebar/settings/viewport/grid' ) ).setWidth( '90px' ) );
  11. var show = new UI.THREE.Boolean( true ).onChange( update );
  12. container.add( show, new UI.Break() );
  13. container.add( new UI.Text( strings.getKey( 'sidebar/settings/viewport/view' ) ).setWidth( '90px' ) );
  14. var sceneViewOptions = new UI.Select().setOptions( {
  15. left: 'left',
  16. right: 'right',
  17. top: 'top',
  18. bottom: 'bottom'
  19. } );
  20. if ( config.getKey( 'sceneCameraView' ) !== undefined ) {
  21. sceneViewOptions.setValue( config.getKey( 'sceneCameraView' ) );
  22. } else {
  23. sceneViewOptions.setValue( 'left' );
  24. }
  25. sceneViewOptions.onChange( function () {
  26. config.setKey( 'sceneCameraView', sceneViewOptions.getValue() );
  27. signals.sceneGraphChanged.dispatch();
  28. } );
  29. container.add( sceneViewOptions );
  30. /*
  31. var snapSize = new UI.Number( 25 ).setWidth( '40px' ).onChange( update );
  32. container.add( snapSize );
  33. var snap = new UI.THREE.Boolean( false, 'snap' ).onChange( update );
  34. container.add( snap );
  35. */
  36. function update() {
  37. signals.showGridChanged.dispatch( show.getValue() );
  38. // signals.snapChanged.dispatch( snap.getValue() === true ? snapSize.getValue() : null );
  39. }
  40. return container;
  41. };