RemoveTool.js 781 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * RemoveTool.js
  3. *
  4. * @author realor
  5. */
  6. import { Tool } from './Tool.js'
  7. class RemoveTool extends Tool {
  8. constructor(application, options) {
  9. super(application)
  10. this.name = 'remove'
  11. this.label = 'tool.remove.label'
  12. this.help = 'tool.remove.help'
  13. this.className = 'remove'
  14. this.immediate = true
  15. this.setOptions(options)
  16. }
  17. execute() {
  18. const application = this.application
  19. let objects = application.selection.roots
  20. for (let i = 0; i < objects.length; i++) {
  21. let object = objects[i]
  22. if (object.parent !== application.scene) {
  23. application.removeObject(object)
  24. }
  25. }
  26. }
  27. }
  28. export { RemoveTool }