You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
986 B
53 lines
986 B
import { UIPanel } from './libs/ui.js';
|
|
import { APP } from './libs/app.js';
|
|
|
|
function Player( editor ) {
|
|
|
|
const signals = editor.signals;
|
|
|
|
const container = new UIPanel();
|
|
container.setId( 'player' );
|
|
container.setPosition( 'absolute' );
|
|
container.setDisplay( 'none' );
|
|
|
|
//
|
|
|
|
const player = new APP.Player();
|
|
container.dom.appendChild( player.dom );
|
|
|
|
window.addEventListener( 'resize', function () {
|
|
|
|
player.setSize( container.dom.clientWidth, container.dom.clientHeight );
|
|
|
|
} );
|
|
|
|
signals.windowResize.add( function () {
|
|
|
|
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();
|
|
|
|
} );
|
|
|
|
signals.stopPlayer.add( function () {
|
|
|
|
container.setDisplay( 'none' );
|
|
|
|
player.stop();
|
|
player.dispose();
|
|
|
|
} );
|
|
|
|
return container;
|
|
|
|
}
|
|
|
|
export { Player };
|
|
|