UNPKG

awv3

Version:
1 lines 23.2 kB
"use strict";function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function check(e,t){if(!e)throw new Error(t)}exports.__esModule=!0,exports.SketcherUnitTests=exports.SketcherAutomation=void 0;var _regenerator=require("babel-runtime/regenerator"),_regenerator2=_interopRequireDefault(_regenerator),_asyncToGenerator2=require("babel-runtime/helpers/asyncToGenerator"),_asyncToGenerator3=_interopRequireDefault(_asyncToGenerator2),_getIterator2=require("babel-runtime/core-js/get-iterator"),_getIterator3=_interopRequireDefault(_getIterator2),_toConsumableArray2=require("babel-runtime/helpers/toConsumableArray"),_toConsumableArray3=_interopRequireDefault(_toConsumableArray2),_possibleConstructorReturn2=require("babel-runtime/helpers/possibleConstructorReturn"),_possibleConstructorReturn3=_interopRequireDefault(_possibleConstructorReturn2),_inherits2=require("babel-runtime/helpers/inherits"),_inherits3=_interopRequireDefault(_inherits2),_classCallCheck2=require("babel-runtime/helpers/classCallCheck"),_classCallCheck3=_interopRequireDefault(_classCallCheck2),someAutomationStuff=function(){var e=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){var r,n,o,a,c,s=this;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.drawLine(new _three2.default.Vector2(50,100),new _three2.default.Vector2(100,50));case 2:return r=e.sent,e.next=5,t.drawLine(new _three2.default.Vector2(125,(-50)),new _three2.default.Vector2(125,50));case 5:return n=e.sent,e.next=8,t.dragSketchPoint(t.getStartPoint(r),[new _three2.default.Vector2(50,100),new _three2.default.Vector2(60,100),new _three2.default.Vector2(70,100),new _three2.default.Vector2(80,100),new _three2.default.Vector2(90,100),new _three2.default.Vector2(100,100)],!0);case 8:return e.next=10,t.dragSketchPoint(t.getEndPoint(n),[new _three2.default.Vector2(125,50),new _three2.default.Vector2(50,50)],!0);case 10:return e.next=12,t.chooseTool("fixation");case 12:return e.next=14,t.clickObject(t.getEndPoint(n));case 14:return e.next=16,t.solveConstraints();case 16:return e.next=18,t.dragSketchPoint(t.getEndPoint(n),[new _three2.default.Vector2((-100),(-100))],!1);case 18:return e.next=20,t.dragSketchLine(n,[new _three2.default.Vector2((-100),(-100))]);case 20:return e.next=22,t.chooseTool("polyline");case 22:return e.next=24,t.trackAdded((0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.mouseClickAt(new _three2.default.Vector2((-100),0));case 2:return e.next=4,t.mouseClickAt(new _three2.default.Vector2((-100),50));case 4:case"end":return e.stop()}},e,s)})));case 24:return e.t0=_geomobjects.Line,o=e.sent.ofType(e.t0).single(),e.next=28,t.chooseTool("arcTangent");case 28:return e.next=30,t.trackAdded((0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.mouseClickAt(new _three2.default.Vector2((-50),100));case 2:case"end":return e.stop()}},e,s)})));case 30:return e.t1=_geomobjects.Arc,a=e.sent.ofType(e.t1).single(),e.next=34,t.trackAdded((0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.mouseClickAt(new _three2.default.Vector2(0,100));case 2:case"end":return e.stop()}},e,s)})));case 34:return e.t2=_geomobjects.Line,c=e.sent.ofType(e.t2).single(),e.next=38,t.chooseTool("empty");case 38:return e.next=40,t.hoverObject(o);case 40:return e.next=42,t.unhoverObject(o);case 42:return e.next=44,t.hoverObject(c);case 44:return e.next=46,t.unhoverObject(c);case 46:return e.next=48,t.hoverObject(a);case 48:return e.next=50,t.unhoverObject(a);case 50:return e.next=52,t.dragSketchPoint(t.getCenterPoint(a),[t.getPos(t.getCenterPoint(a)),new _three2.default.Vector2(10,30)],!0);case 52:return e.next=54,t.setIncremental(!0);case 54:return e.next=56,t.dragSketchPoint(t.getCenterPoint(a),[t.getPos(t.getCenterPoint(a)),new _three2.default.Vector2(10,30),new _three2.default.Vector2(0,10),new _three2.default.Vector2(0,20),new _three2.default.Vector2(0,30),new _three2.default.Vector2((-10),30),new _three2.default.Vector2((-10),20),new _three2.default.Vector2((-20),10),new _three2.default.Vector2((-50),0)],!0);case 56:return e.next=58,t.chooseTool("fixation");case 58:return e.next=60,t.clickObject(t.getStartPoint(o));case 60:return e.next=62,t.chooseTool("fixation");case 62:return e.next=64,t.clickObject(t.getEndPoint(c));case 64:return e.next=66,t.chooseTool("empty");case 66:return e.next=68,t.dragSketchPoint(t.getCenterPoint(a),[new _three2.default.Vector2(0,10),new _three2.default.Vector2(0,20),new _three2.default.Vector2(0,30),new _three2.default.Vector2((-10),30),new _three2.default.Vector2((-10),20),new _three2.default.Vector2((-20),10),new _three2.default.Vector2((-50),30)]);case 68:return e.next=70,t.solveConstraints();case 70:return e.next=72,t.deleteObject(n);case 72:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}(),_delay=require("delay"),_delay2=_interopRequireDefault(_delay),_three=require("three"),_three2=_interopRequireDefault(_three),_object=require("three/object3"),_object2=_interopRequireDefault(_object),_sketch=require("sketcher/sketch"),_sketch2=_interopRequireDefault(_sketch),_sketcher=require("sketcher/sketcher"),_sketcher2=_interopRequireDefault(_sketcher),_geomobjects=require("sketcher/geomobjects"),_cchelpers=require("sketcher/cchelpers"),AddRemoveTracker=function(){function e(t){(0,_classCallCheck3.default)(this,e),this.sketch=t,this.listeners={},this.changes={}}return e.prototype.markChanged=function(e,t){e.id in this.changes||(this.changes[e.id]={object:e,status:0}),t&&(this.changes[e.id].status+=t)},e.prototype.listen=function(){var e=this,t=function(t){return e.markChanged(t,1)},r=function(t){return e.markChanged(t,-1)};this.sketch.on("SketchAdded",t),this.sketch.on("SketchRemoved",r),this.listeners.SketchAdded=t,this.listeners.SketchRemoved=r},e.prototype.ignore=function(){this.sketch.removeListener("SketchAdded",this.listeners.SketchAdded),this.sketch.removeListener("SketchRemoved",this.listeners.SketchRemoved)},e.prototype.getAllChanges=function(){var e={added:[],removed:[],changed:[]};for(var t in this.changes){var r=this.changes[t],n=e.changed;r.status>0&&(n=e.added),r.status<0&&(n=e.removed),n.push(r.object)}return e},e}(),ChangesArray=function(e){function t(r,n){(0,_classCallCheck3.default)(this,t);var o=(0,_possibleConstructorReturn3.default)(this,e.call.apply(e,[this].concat((0,_toConsumableArray3.default)(r))));return o.label=n,o}return(0,_inherits3.default)(t,e),t.prototype.single=function(){return check(1===this.length,"Expected single "+this.label+" object"),this[0]},t.prototype.ofType=function(e){for(var r=[],n=this,o=Array.isArray(n),a=0,n=o?n:(0,_getIterator3.default)(n);;){var c;if(o){if(a>=n.length)break;c=n[a++]}else{if(a=n.next(),a.done)break;c=a.value}var s=c;s instanceof e&&r.push(s)}return new t(r,this.label)},t.prototype.singleOfType=function(e){return this.single().ofType(e).single()[0]},t}(Array),SketcherAutomation=exports.SketcherAutomation=function(){function e(t){(0,_classCallCheck3.default)(this,e),this.sketcher=t,this.tickWaitTime=0,this.linearTolerance=.01,this.safePoint=new _three2.default.Vector2((-123.456),(-98.765))}return e.prototype.setRootObject=function(e){this.rootObject=e},e.prototype.execute=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.sketcher.__parentView.input.enabled=!1,e.prev=1,e.next=4,t(this);case 4:return e.prev=4,this.sketcher.__parentView.input.enabled=!0,e.finish(4);case 7:case"end":return e.stop()}},e,this,[[1,,4,7]])}));return e}(),e.prototype.setTickWaitTime=function(e){this.tickWaitTime=e},e.prototype.tick=function(){function e(){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this.tickWaitTime>0){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,_delay2.default)(this.tickWaitTime);case 4:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.createSketch=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r,n){var o;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n||(check(this.rootObject,"Neither part nor root object not specified"),this.rootObject.traverse(function(e){e instanceof _cchelpers.Part&&(n=e)}),check(n,"Cannot find any part in ClassCad tree")),t=t||n.getWorldQuaternion(),r=r||n.getWorldPosition(),e.next=5,this.sketcher.newSketch(t,r,n);case 5:return o=e.sent,check(o,"Failed to create new sketch"),e.abrupt("return",o);case 8:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.selectSketch=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return check(t instanceof _sketch2.default,"Sketch is not specified or not a sketch"),e.next=3,this.sketcher.selectSketch(t);case 3:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.deselectSketch=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(check(!t||t===this.sketcher.currentSketch,"Deselecting wrong sketch"),!r){e.next=6;break}return e.next=4,this.sketcher.sketchAreaRightClicked(this.sketcher.currentSketch);case 4:e.next=8;break;case 6:return e.next=8,this.sketcher.deselectSketch();case 8:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.chooseTool=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sketcher.chooseTool(t||"empty");case 2:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.solveConstraints=function(){function e(){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sketcher.solveConstraints();case 2:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.setIncremental=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sketcher.setIncrementalLevel(t);case 2:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.trackAny=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){var n,o;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r||(r=this.sketcher.currentSketch),n=new AddRemoveTracker(r),n.listen(),e.next=5,t();case 5:return n.ignore(),o=n.getAllChanges(),e.abrupt("return",o);case 8:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.trackAdded=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){var n;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.trackAny(t,r);case 2:return n=e.sent,check(0===n.removed.length,"Element removed unexpectedly"),e.abrupt("return",new ChangesArray(n.added));case 5:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.trackRemoved=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){var n;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.trackAny(t,r);case 2:return n=e.sent,check(0===n.added.length,"Element added unexpectedly"),e.abrupt("return",new ChangesArray(n.removed));case 5:case"end":return e.stop()}},e,this)}));return e}(),e.prototype._mouseMoveTo=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.sketcher.modelData.interactionPoint.set(t.x,t.y);case 2:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.mouseMoveTo=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return check(this.sketcher.currentSketch,"Moving mouse without selected sketch"),e.next=3,this._mouseMoveTo(t);case 3:return e.next=5,this.tick();case 5:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.mouseClickAt=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return check(this.sketcher.currentSketch,"Clicking mouse without selected sketch"),e.next=3,this._mouseMoveTo(t);case 3:return e.next=5,this.sketcher.sketchAreaClicked(this.sketcher.currentSketch);case 5:return e.next=7,this.tick();case 7:case"end":return e.stop()}},e,this)}));return e}(),e.prototype._interactionEmit=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){for(var n,o=arguments.length,a=Array(o>2?o-2:0),c=2;c<o;c++)a[c-2]=arguments[c];return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return check(t instanceof _object2.default,"Interacting with something not being a THREE object"),t.interact instanceof _three2.default.Mesh&&(t=t.interact),check(t.interaction&&t.hasListener(r),"Interacting with object without interaction or handler installed"),t.traverseAncestors(function(e){return check(e.visible,"Interacting with invisible object")}),e.next=6,(n=t).emit.apply(n,[r].concat(a));case 6:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.clickObject=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._interactionEmit(t,_object2.default.Events.Interaction.Clicked);case 2:return e.next=4,this.tick();case 4:case"end":return e.stop()}},e,this)}));return e}(),e.prototype._dragPathRelativeToAbsolute=function(e,t){var r=null;e instanceof _geomobjects.Point&&(r=e.position),(e instanceof _geomobjects.Line||e instanceof _geomobjects.Arc)&&(r=e.getMiddlePosition()),check(r,"Cannot detect key point for relative object dragging"),t=[new _three2.default.Vector2(0,0)].concat(t);for(var n=t,o=Array.isArray(n),a=0,n=o?n:(0,_getIterator3.default)(n);;){var c;if(o){if(a>=n.length)break;c=n[a++]}else{if(a=n.next(),a.done)break;c=a.value}var s=c;s.add(r)}return t},e.prototype.dragObject=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r,n){var o,a,c,s=this;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n||(r=this._dragPathRelativeToAbsolute(t,r)),check(r.length>=2,"Dragging object along less than two key points"),r=[].concat(r),o=function(){var e=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(r,n){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s._mouseMoveTo(r);case 2:return e.next=4,s._interactionEmit(t,n,{});case 4:return e.next=6,s.tick();case 6:case"end":return e.stop()}},e,s)}));return function(t,r){return e.apply(this,arguments)}}(),a=r.length,e.next=7,o(r[0],_object2.default.Events.Interaction.Picked);case 7:c=0;case 8:if(!(c<a)){e.next=14;break}return e.next=11,o(r[c],_object2.default.Events.Interaction.Dragged);case 11:c++,e.next=8;break;case 14:return e.next=16,o(r[a-1],_object2.default.Events.Interaction.Dropped);case 16:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.dragSketchPoint=function(){function e(e,r,n){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r,n){var o;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return check(t instanceof _geomobjects.Point,"Dragged object is not a point"),o=new _three2.default.Vector2(t.position.x,t.position.y),check(!n||o.distanceTo(r[0])<=this.linearTolerance,"Dragging point starting from wrong position"),e.next=5,this.dragObject(t,r,n);case 5:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.dragSketchLine=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return check(t instanceof _geomobjects.Line,"Dragged object is not a line"),e.next=3,this.dragObject(t,r,!1);case 3:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.dragSketchArc=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return check(t instanceof _geomobjects.Arc,"Dragged object is not a arc"),e.next=3,this.dragObject(t,r,!1);case 3:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.hoverObject=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t._testing_hovered){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._mouseMoveTo(this.getPointOn(t));case 4:return e.next=6,this._interactionEmit(t,_object2.default.Events.Interaction.Hovered,{});case 6:return t._testing_hovered=!0,e.next=9,this.tick();case 9:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.unhoverObject=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t._testing_hovered){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,this._mouseMoveTo(this.safePoint);case 4:return e.next=6,this._interactionEmit(t,_object2.default.Events.Interaction.Unhovered,{});case 6:return delete t._testing_hovered,e.next=9,this.tick();case 9:case"end":return e.stop()}},e,this)}));return e}(),e.prototype._drawSimple=function(){function e(e,r,n,o){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r,n,o){var a,c,s=this;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.chooseTool(t);case 2:return e.next=4,this.trackAdded((0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(){var t;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=0;case 1:if(!(t<n.length)){e.next=7;break}return e.next=4,s.mouseClickAt(n[t]);case 4:t++,e.next=1;break;case 7:case"end":return e.stop()}},e,s)})));case 4:if(a=e.sent,c=a.ofType(r).single(),o){e.next=9;break}return e.next=9,this.chooseTool();case 9:return e.abrupt("return",c);case 10:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.drawPoint=function(){function e(e){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._drawSimple("point",_geomobjects.Point,[t]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.drawLine=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this._drawSimple("line",_geomobjects.Line,[t,r]);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.deleteObject=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){var n,o=this;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.chooseTool("delete");case 2:return e.next=4,this.trackRemoved((0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(){return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,o.clickObject(t);case 2:case"end":return e.stop()}},e,o)})));case 4:if(n=e.sent,check(n.indexOf(t)!==-1,"Failed to delete object"),r){e.next=9;break}return e.next=9,this.chooseTool();case 9:case"end":return e.stop()}},e,this)}));return e}(),e.prototype.getEndPoint=function(e,t){check(e instanceof _geomobjects.Line||e instanceof _geomobjects.Arc,"Getting endpoint of something not being line or arc"),void 0===t&&(t=1);var r=e.points[t];return check(r instanceof _geomobjects.Point,"Cannot get endpoint of object"),r},e.prototype.getStartPoint=function(e){return this.getEndPoint(e,0)},e.prototype.getCenterPoint=function(e){return check(e instanceof _geomobjects.Arc,"Getting center point of not an arc"),e.centerPoint},e.prototype.getPos=function(e){return check(e instanceof _geomobjects.Point,"Getting position of not a point"),new _three2.default.Vector2(e.position.x,e.position.y)},e.prototype.getPointOn=function(e){var t=void 0;return e instanceof _geomobjects.Point?t=e.position:(e instanceof _geomobjects.Line||e instanceof _geomobjects.Arc)&&(t=e.getMiddlePosition()),check(t,"Getting point on object of unknown type"),new _three2.default.Vector2(t.x,t.y)},e}(),SketcherUnitTests=exports.SketcherUnitTests=function e(){(0,_classCallCheck3.default)(this,e)};exports.default=function(){function e(e,r){return t.apply(this,arguments)}var t=(0,_asyncToGenerator3.default)(_regenerator2.default.mark(function e(t,r){var n;return _regenerator2.default.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=new SketcherAutomation(t),n.setTickWaitTime(500),n.execute(someAutomationStuff);case 3:case"end":return e.stop()}},e,this)}));return e}();