Home Reference Source Repository

src/lib/descriptors/Geometry/Shapes/HoleDescriptor.js

import * as THREE from 'three';
import invariant from 'fbjs/lib/invariant';

import PathDescriptorBase from './PathDescriptorBase';
import HoleAction from '../../../Shapes/HoleAction';

class HoleDescriptor extends PathDescriptorBase {
  construct() {
    return new HoleAction();
  }

  performChildAction(threeObject, child) {
    child.performAction(threeObject.path);
  }

  setParent(threeObject, parentObject3D) {
    invariant(parentObject3D instanceof THREE.Shape, 'Holes can only be added to shapes.');

    return super.setParent(threeObject, parentObject3D);
  }
}

module.exports = HoleDescriptor;