SelectParentTool.js 677 B

1234567891011121314151617181920212223242526272829
  1. /*
  2. * SelectParentTool.js
  3. *
  4. * @author realor
  5. */
  6. import { Tool } from './Tool.js'
  7. class SelectParentTool extends Tool {
  8. constructor(application, options) {
  9. super(application)
  10. this.name = 'select_parent'
  11. this.label = 'tool.select_parent.label'
  12. this.className = 'select_parent'
  13. this.immediate = true
  14. this.setOptions(options)
  15. }
  16. execute() {
  17. const selection = this.application.selection
  18. let objects = selection.objects
  19. objects = objects.map(object => object.parent).filter(object => object)
  20. selection.set(...objects)
  21. }
  22. }
  23. export { SelectParentTool }