From: john@roojs.com Date: Thu, 27 Dec 2018 08:13:28 +0000 (+0800) Subject: FIX: merge bezier_signature X-Git-Url: http://git.roojs.org/?p=roojs1;a=commitdiff_plain;h=8ae8cc8a4daeeca1e96d69ba554a8ac2e5209e56 FIX: merge bezier_signature --- diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index dd82b3bbb3..1d33a0d8ac 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -41865,8 +41865,6 @@ Roo.extend(Roo.bootstrap.BezierSignature, Roo.bootstrap.Component, { img.src = img_src; - Roo.log(img); - this.canvasElCtx().drawImage(img, 0, 0); }, diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index 8ed27478d6..a72d9164eb 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1747,7 +1747,7 @@ var C=this.canvasElCtx();var D=B.endWidth-B.startWidth;var E=Math.floor(B.length x+=F*B.endPoint.x;var y=G*B.startPoint.y;y+=3*uu*t*B.control1.y;y+=3*u*tt*B.control2.y;y+=F*B.endPoint.y;var H=B.startWidth+F*D;this.drawCurveSegment(x,y,H);}C.closePath();C.fill();},drawCurveSegment:function(x,y,A){var B=this.canvasElCtx();B.moveTo(x,y); B.arc(x,y,A,0,2*Math.PI,false);this._isEmpty=false;},clear:function(){var A=this.canvasElCtx();var B=this.canvasEl().dom;A.fillStyle=this.backgroundColor;A.clearRect(0,0,B.width,B.height);A.fillRect(0,0,B.width,B.height);this._data=[];this.reset();this._isEmpty=true; },canvasEl:function(){return this.el.select('canvas',true).first();},canvasElCtx:function(){return this.el.select('canvas',true).first().dom.getContext('2d');},getImage:function(A){if(this._isEmpty){return false;}return this.canvasEl().dom.toDataURL('image/'+A,false); -},drawFromImage:function(A){var B=new Image();B.src=A;Roo.log(B);this.canvasElCtx().drawImage(B,0,0);},Point:(function(){function Point(x,y,A){this.x=x;this.y=y;this.time=A||Date.now();}Point.prototype.distanceTo=function(A){return Math.sqrt(Math.pow(this.x-A.x,2)+Math.pow(this.y-A.y,2)); +},drawFromImage:function(A){var B=new Image();B.src=A;this.canvasElCtx().drawImage(B,0,0);},Point:(function(){function Point(x,y,A){this.x=x;this.y=y;this.time=A||Date.now();}Point.prototype.distanceTo=function(A){return Math.sqrt(Math.pow(this.x-A.x,2)+Math.pow(this.y-A.y,2)); };Point.prototype.equals=function(A){return this.x===A.x&&this.y===A.y&&this.time===A.time;};Point.prototype.velocityFrom=function(A){return this.time!==A.time?this.distanceTo(A)/(this.time-A.time):0;};return Point;}()),Bezier:(function(){function Bezier(A,B,C,D,E,F){this.startPoint=A; this.control2=B;this.control1=C;this.endPoint=D;this.startWidth=E;this.endWidth=F;}Bezier.fromPoints=function(A,B,C){var c2=this.calculateControlPoints(A[0],A[1],A[2],C).c2;var c3=this.calculateControlPoints(A[1],A[2],A[3],C).c1;return new Bezier(A[1],c2,c3,A[2],B.start,B.end); };Bezier.calculateControlPoints=function(s1,s2,s3,A){var B=s1.x-s2.x;var C=s1.y-s2.y;var D=s2.x-s3.x;var E=s2.y-s3.y;var m1={x:(s1.x+s2.x)/2.0,y:(s1.y+s2.y)/2.0};var m2={x:(s2.x+s3.x)/2.0,y:(s2.y+s3.y)/2.0};var l1=Math.sqrt(B*B+C*C);var l2=Math.sqrt(D*D+E*E);