Menubar.Play.js 803 B

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