Menubar.Play.js 736 B

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