mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-26 07:24:57 +01:00
51 lines
883 B
JavaScript
Executable File
51 lines
883 B
JavaScript
Executable File
/**
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
|
|
var Player = function ( editor ) {
|
|
|
|
var signals = editor.signals;
|
|
|
|
var container = new UI.Panel();
|
|
container.setId( 'player' );
|
|
container.setPosition( 'absolute' );
|
|
container.setDisplay( 'none' );
|
|
|
|
//
|
|
|
|
var player = new APP.Player();
|
|
|
|
window.addEventListener( 'resize', function () {
|
|
|
|
if ( player.dom === undefined ) return;
|
|
|
|
player.setSize( container.dom.clientWidth, container.dom.clientHeight );
|
|
|
|
} );
|
|
|
|
signals.startPlayer.add( function () {
|
|
|
|
container.setDisplay( '' );
|
|
|
|
player.load( editor.toJSON() );
|
|
player.setSize( container.dom.clientWidth, container.dom.clientHeight );
|
|
player.play();
|
|
|
|
container.dom.appendChild( player.dom );
|
|
|
|
} );
|
|
|
|
signals.stopPlayer.add( function () {
|
|
|
|
container.setDisplay( 'none' );
|
|
|
|
player.stop();
|
|
|
|
container.dom.removeChild( player.dom );
|
|
|
|
} );
|
|
|
|
return container;
|
|
|
|
};
|