Sidebar.Script.js 800 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Sidebar.Script = function ( editor ) {
  5. var signals = editor.signals;
  6. var container = new UI.CollapsiblePanel();
  7. container.setCollapsed( editor.config.getKey( 'ui/sidebar/script/collapsed' ) );
  8. container.onCollapsedChange( function ( boolean ) {
  9. editor.config.setKey( 'ui/sidebar/script/collapsed', boolean );
  10. } );
  11. container.setDisplay( 'none' );
  12. container.addStatic( new UI.Text( 'Script' ).setTextTransform( 'uppercase' ) );
  13. container.add( new UI.Break() );
  14. var source = new Sidebar.Script.Editor( editor );
  15. container.add( source );
  16. signals.objectSelected.add( function ( object ) {
  17. if ( object !== null ) {
  18. container.setDisplay( 'block' );
  19. } else {
  20. container.setDisplay( 'none' );
  21. }
  22. } );
  23. return container;
  24. }