Menubar.Play.js 634 B

1234567891011121314151617181920212223242526272829
  1. Menubar.Play = function ( editor ) {
  2. var container = new UI.Panel();
  3. container.setClass( 'menu' );
  4. var player = new Player();
  5. var title = new UI.Panel();
  6. title.setClass( 'title' );
  7. title.setTextContent( 'Play' );
  8. title.onClick( function () {
  9. player.load( editor.scene.toJSON() );
  10. player.setSize( 800, 600 );
  11. player.play();
  12. var popup = window.open( '', 'preview', 'width=800,height=600' );
  13. popup.addEventListener( 'beforeunload', function () {
  14. player.stop();
  15. } );
  16. popup.document.body.style.margin = 0;
  17. popup.document.body.appendChild( player.dom );
  18. } );
  19. container.add( title );
  20. return container;
  21. };
粤ICP备19079148号