Menubar.Play.js 747 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import { UIPanel } from './libs/ui.js';
  2. function MenubarPlay( editor ) {
  3. var signals = editor.signals;
  4. var strings = editor.strings;
  5. var container = new UIPanel();
  6. container.setClass( 'menu' );
  7. var isPlaying = false;
  8. var title = new UIPanel();
  9. title.setClass( 'title' );
  10. title.setTextContent( strings.getKey( 'menubar/play' ) );
  11. title.onClick( function () {
  12. if ( isPlaying === false ) {
  13. isPlaying = true;
  14. title.setTextContent( strings.getKey( 'menubar/play/stop' ) );
  15. signals.startPlayer.dispatch();
  16. } else {
  17. isPlaying = false;
  18. title.setTextContent( strings.getKey( 'menubar/play/play' ) );
  19. signals.stopPlayer.dispatch();
  20. }
  21. } );
  22. container.add( title );
  23. return container;
  24. }
  25. export { MenubarPlay };