UNPKG

awv3

Version:
28 lines (25 loc) 870 B
import * as ConstraintType from '../constraint/type'; import Point from './point'; import Line from './line'; import Arc from './arc'; import Circle from './circle'; import Sketch from './sketch'; import Constraint from './constraint'; export default function Graphics(name) { switch (name) { case 'CC_Point': return new Point(); case 'CC_Line': return new Line(); case 'CC_Arc': return new Arc(); case 'CC_Circle': return new Circle(); case 'CC_Sketch': return new Sketch(); } if (name.endsWith('Constraint')) if (!Object.values(ConstraintType).find(ct => ct.type === name).isParametric) return new Constraint(); } // Support hot reloading if (module.hot) module.hot.accept(['./point', './line', './arc', './circle', './sketch', './constraint']);