Sidebar.Project.js 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. import { UIPanel, UIRow, UIInput, UICheckbox, UIText, UISpan } from './libs/ui.js';
  2. /* import { SidebarProjectMaterials } from './Sidebar.Project.Materials.js'; */
  3. import { SidebarProjectRenderer } from './Sidebar.Project.Renderer.js';
  4. import { SidebarProjectVideo } from './Sidebar.Project.Video.js';
  5. function SidebarProject( editor ) {
  6. const config = editor.config;
  7. const signals = editor.signals;
  8. const strings = editor.strings;
  9. const container = new UISpan();
  10. const settings = new UIPanel();
  11. settings.setBorderTop( '0' );
  12. settings.setPaddingTop( '20px' );
  13. container.add( settings );
  14. // Title
  15. const titleRow = new UIRow();
  16. const title = new UIInput( config.getKey( 'project/title' ) ).setLeft( '100px' ).setWidth( '150px' ).onChange( function () {
  17. config.setKey( 'project/title', this.getValue() );
  18. } );
  19. titleRow.add( new UIText( strings.getKey( 'sidebar/project/title' ) ).setWidth( '90px' ) );
  20. titleRow.add( title );
  21. settings.add( titleRow );
  22. // Editable
  23. const editableRow = new UIRow();
  24. const editable = new UICheckbox( config.getKey( 'project/editable' ) ).setLeft( '100px' ).onChange( function () {
  25. config.setKey( 'project/editable', this.getValue() );
  26. } );
  27. editableRow.add( new UIText( strings.getKey( 'sidebar/project/editable' ) ).setWidth( '90px' ) );
  28. editableRow.add( editable );
  29. settings.add( editableRow );
  30. //
  31. /* container.add( new SidebarProjectMaterials( editor ) ); */
  32. container.add( new SidebarProjectRenderer( editor ) );
  33. if ( 'SharedArrayBuffer' in window ) {
  34. container.add( new SidebarProjectVideo( editor ) );
  35. }
  36. // Signals
  37. signals.editorCleared.add( function () {
  38. title.setValue( '' );
  39. config.setKey( 'project/title', '' );
  40. } );
  41. return container;
  42. }
  43. export { SidebarProject };
粤ICP备19079148号