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.
39 lines
756 B
39 lines
756 B
import { UIPanel } from '../libs/ui.js';
|
|
|
|
function MenubarPlay( editor ) {
|
|
|
|
const signals = editor.signals;
|
|
const strings = editor.strings;
|
|
|
|
const container = new UIPanel();
|
|
container.setClass( 'menu' );
|
|
|
|
let isPlaying = false;
|
|
|
|
const title = new UIPanel();
|
|
title.setClass( 'title' );
|
|
title.setTextContent( strings.getKey( 'menubar/play' ) );
|
|
title.onClick( function () {
|
|
|
|
if ( isPlaying === false ) {
|
|
|
|
isPlaying = true;
|
|
title.setTextContent( strings.getKey( 'menubar/play/stop' ) );
|
|
signals.startPlayer.dispatch();
|
|
|
|
} else {
|
|
|
|
isPlaying = false;
|
|
title.setTextContent( strings.getKey( 'menubar/play/play' ) );
|
|
signals.stopPlayer.dispatch();
|
|
|
|
}
|
|
|
|
} );
|
|
container.add( title );
|
|
|
|
return container;
|
|
|
|
}
|
|
|
|
export { MenubarPlay };
|
|
|