mirror of
https://github.com/Doodle3D/Doodle3D-Slicer.git
synced 2024-11-30 01:14:57 +01:00
59 lines
1.1 KiB
JavaScript
59 lines
1.1 KiB
JavaScript
|
/**
|
||
|
* @author mrdoob / http://mrdoob.com/
|
||
|
*/
|
||
|
|
||
|
Menubar.Edit = function ( editor ) {
|
||
|
|
||
|
var container = new UI.Panel();
|
||
|
container.setClass( 'menu' );
|
||
|
|
||
|
var title = new UI.Panel();
|
||
|
title.setClass( 'title' );
|
||
|
title.setTextContent( 'Edit' );
|
||
|
container.add( title );
|
||
|
|
||
|
var options = new UI.Panel();
|
||
|
options.setClass( 'options' );
|
||
|
container.add( options );
|
||
|
|
||
|
// Clone
|
||
|
|
||
|
var option = new UI.Panel();
|
||
|
option.setClass( 'option' );
|
||
|
option.setTextContent( 'Clone' );
|
||
|
option.onClick( function () {
|
||
|
|
||
|
var object = editor.selected;
|
||
|
|
||
|
if ( object.parent === undefined ) return; // avoid cloning the camera or scene
|
||
|
|
||
|
object = object.clone();
|
||
|
|
||
|
editor.addObject( object );
|
||
|
editor.select( object );
|
||
|
|
||
|
} );
|
||
|
options.add( option );
|
||
|
|
||
|
// Delete
|
||
|
|
||
|
var option = new UI.Panel();
|
||
|
option.setClass( 'option' );
|
||
|
option.setTextContent( 'Delete' );
|
||
|
option.onClick( function () {
|
||
|
|
||
|
var object = editor.selected;
|
||
|
|
||
|
if ( confirm( 'Delete ' + object.name + '?' ) === false ) return;
|
||
|
|
||
|
var parent = object.parent;
|
||
|
editor.removeObject( object );
|
||
|
editor.select( parent );
|
||
|
|
||
|
} );
|
||
|
options.add( option );
|
||
|
|
||
|
return container;
|
||
|
|
||
|
};
|