Menubar.Edit.js 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. Menubar.Edit = function ( editor ) {
  2. var container = new UI.Panel();
  3. container.setClass( 'menu' );
  4. container.onMouseOver( function () { options.setDisplay( 'block' ) } );
  5. container.onMouseOut( function () { options.setDisplay( 'none' ) } );
  6. container.onClick( function () { options.setDisplay( 'block' ) } );
  7. var title = new UI.Panel();
  8. title.setTextContent( 'Edit' ).setColor( '#666' );
  9. title.setMargin( '0px' );
  10. title.setPadding( '8px' );
  11. container.add( title );
  12. //
  13. var options = new UI.Panel();
  14. options.setClass( 'options' );
  15. options.setDisplay( 'none' );
  16. container.add( options );
  17. // clone
  18. var option = new UI.Panel();
  19. option.setClass( 'option' );
  20. option.setTextContent( 'Clone' );
  21. option.onClick( function () { editor.cloneObject( editor.selected ); } );
  22. options.add( option );
  23. // flatten
  24. var option = new UI.Panel();
  25. option.setClass( 'option' );
  26. option.setTextContent( 'Flatten' );
  27. option.onClick( function () { editor.flattenObject( editor.selected ); } );
  28. options.add( option );
  29. // delete
  30. var option = new UI.Panel();
  31. option.setClass( 'option' );
  32. option.setTextContent( 'Delete' );
  33. option.onClick( function () { editor.removeObject( editor.selected ); } );
  34. options.add( option );
  35. //
  36. return container;
  37. }