Menubar.Play.js 617 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * @author mrdoob / http://mrdoob.com/
  3. */
  4. Menubar.Play = function ( editor ) {
  5. var signals = editor.signals;
  6. var container = new UI.Panel();
  7. container.setClass( 'menu' );
  8. var isPlaying = false;
  9. var title = new UI.Panel();
  10. title.setClass( 'title' );
  11. title.setTextContent( 'Play' );
  12. title.onClick( function () {
  13. if ( isPlaying === false ) {
  14. isPlaying = true;
  15. title.setTextContent( 'Stop' );
  16. signals.startPlayer.dispatch();
  17. } else {
  18. isPlaying = false;
  19. title.setTextContent( 'Play' );
  20. signals.stopPlayer.dispatch();
  21. }
  22. } );
  23. container.add( title );
  24. return container;
  25. };