text: function onMouseDown(e){nodeLayer.activate(),(path=new Path).strokeColor="white";var r=new Path.Circle({center:e.point,radius:7});r.strokeColor="black",r.fillColor="white",nodes.push({x:e.point.x,y:e.point.y,equals:function(e){return this.x==e.x&&this.y==e.y}}),convexHullLayer.activate(),convexHullLayer.removeChildren(),grahamScan(nodes,function(e,r){if(e&&void 0!==r){var n=new Path;n.strokeColor="#98FB98",n.strokeWidth=3,r.forEach(function(e){n.add(new Point(e.x,e.y))}),n.add(new Point(r[0].x,r[0].y))}})}function grahamScan(e,r){if(e)if(1!=e.length){for(var n=[],o=0;o<e.length;o++)n[o]=e[o];var t=n.length,a=[];n.sort(yOrder);var i=n[0];(n=n.splice(1)).sort(function(e,r){var n=e.x-i.x,o=e.y-i.y,t=r.x-i.x,a=r.y-i.y;return o>=0&&a<0?-1:a>=0&&o<0?1:0==o&&0==a?n>=0&&t<0?-1:t>=0&&n<0?1:0:-ccw(i,e,r)}),a.push(i);var c;for(c=0;c<t-1&&i.equals(n[c]);c++);if(c!=t-1){var l;for(l=c+1;l<t-1&&0==ccw(i,n[c],n[l]);l++);a.push(n[l-1]);for(o=l;o<t-1;o++){for(var y=a.pop();ccw(a[a.length-1],y,n[o])<=0;)y=a.pop();a.push(y),a.push(n[o])}r(!0,a)}}else r(!0,void 0);else r(!1,void 0)}function yOrder(e,r){return e.y<r.y?-1:e.y>r.y?1:e.x<r.x?-1:e.x>r.x?1:0}function ccw(e,r,n){var o=(r.x-e.x)*(n.y-e.y)-(r.y-e.y)*(n.x-e.x);return o<0?-1:o>0?1:0}var path,nodes=[],nodeLayer=new Layer,convexHullLayer=new Layer;$("#btn-reset").click(function(){nodeLayer.removeChildren(),convexHullLayer.removeChildren(),paper.view.draw(),nodes=[]});
  