Menubar.Add.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. Menubar.Add = function ( signals ) {
  2. var container = new UI.Panel();
  3. container.setFloat( 'left' );
  4. container.setWidth( '50px' );
  5. container.setCursor( 'pointer' );
  6. container.onMouseOver( function () { options.setDisplay( '' ) } );
  7. container.onMouseOut( function () { options.setDisplay( 'none' ) } );
  8. container.onClick( function () { options.setDisplay( 'none' ) } );
  9. var title = new UI.Panel();
  10. title.setTextContent( 'Add' ).setColor( '#666' );
  11. title.setMargin( '0px' );
  12. title.setPadding( '8px' )
  13. container.add( title );
  14. //
  15. var options = new UI.Panel();
  16. options.setWidth( '140px' );
  17. options.setBackgroundColor( '#ddd' );
  18. options.setPadding( '10px' );
  19. options.setDisplay( 'none' );
  20. container.add( options );
  21. var option = new UI.Panel();
  22. option.setTextContent( 'Sphere' ).setColor( '#666' );
  23. option.onClick( function () { alert( 'Sphere' ) } );
  24. options.add( option );
  25. var option = new UI.Panel();
  26. option.setTextContent( 'Cube' ).setColor( '#666' );
  27. option.onClick( function () { alert( 'Cube' ) } );
  28. options.add( option );
  29. var option = new UI.Panel();
  30. option.setTextContent( 'Plane' ).setColor( '#666' );
  31. option.onClick( function () { alert( 'Plane' ) } );
  32. options.add( option );
  33. return container;
  34. }