mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-16 19:17:57 +01:00
62 lines
1.1 KiB
JavaScript
Executable File
62 lines
1.1 KiB
JavaScript
Executable File
/**
|
|
* @author mrdoob / http://mrdoob.com/
|
|
*/
|
|
|
|
Menubar.Examples = function ( editor ) {
|
|
|
|
var container = new UI.Panel();
|
|
container.setClass( 'menu' );
|
|
|
|
var title = new UI.Panel();
|
|
title.setClass( 'title' );
|
|
title.setTextContent( 'Examples' );
|
|
container.add( title );
|
|
|
|
var options = new UI.Panel();
|
|
options.setClass( 'options' );
|
|
container.add( options );
|
|
|
|
// Examples
|
|
|
|
var items = [
|
|
{ title: 'Arkanoid', file: 'arkanoid.app.json' },
|
|
{ title: 'Camera', file: 'camera.app.json' },
|
|
{ title: 'Particles', file: 'particles.app.json' },
|
|
{ title: 'Pong', file: 'pong.app.json' }
|
|
];
|
|
|
|
var loader = new THREE.XHRLoader();
|
|
|
|
for ( var i = 0; i < items.length; i ++ ) {
|
|
|
|
( function ( i ) {
|
|
|
|
var item = items[ i ];
|
|
|
|
var option = new UI.Panel();
|
|
option.setClass( 'option' );
|
|
option.setTextContent( item.title );
|
|
option.onClick( function () {
|
|
|
|
if ( confirm( 'Any unsaved data will be lost. Are you sure?' ) ) {
|
|
|
|
loader.load( 'examples/' + item.file, function ( text ) {
|
|
|
|
editor.clear();
|
|
editor.fromJSON( JSON.parse( text ) );
|
|
|
|
} );
|
|
|
|
}
|
|
|
|
} );
|
|
options.add( option );
|
|
|
|
} )( i )
|
|
|
|
}
|
|
|
|
return container;
|
|
|
|
};
|