From f4275764a85f25bb0f07a37b8141bd8b1d1f6923 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Fri, 18 Jan 2019 10:52:45 +0800 Subject: [PATCH] Uncommited changes synced --- roojs-bootstrap-debug.js | 37 ++++++++++++++++--------------------- roojs-bootstrap.js | 4 ++-- 2 files changed, 18 insertions(+), 23 deletions(-) diff --git a/roojs-bootstrap-debug.js b/roojs-bootstrap-debug.js index c8164e2ff4..bcb5ad72e3 100644 --- a/roojs-bootstrap-debug.js +++ b/roojs-bootstrap-debug.js @@ -27212,17 +27212,15 @@ Roo.apply(Roo.bootstrap.LocationPicker, { } -});/* - * - LGPL - * - * Alert - * - */ - -/** +});/** * @class Roo.bootstrap.Alert * @extends Roo.bootstrap.Component - * Bootstrap Alert class + * Bootstrap Alert class - shows an alert area box + * eg + * + * @licence LGPL * @cfg {String} title The title of alert * @cfg {String} html The content of alert * @cfg {String} weight ( success | info | warning | danger ) @@ -41545,17 +41543,14 @@ Roo.extend(Roo.bootstrap.MoneyField, Roo.bootstrap.ComboBox, { } });/** -* This script refer to: -* Title: Signature Pad -* Author: szimek -* Availability: https://github.com/szimek/signature_pad -**/ - -/** * @class Roo.bootstrap.BezierSignature * @extends Roo.bootstrap.Component * Bootstrap BezierSignature class - * + * This script refer to: + * Title: Signature Pad + * Author: szimek + * Availability: https://github.com/szimek/signature_pad + * * @constructor * Create a new BezierSignature * @param {Object} config The config object @@ -41570,7 +41565,7 @@ Roo.bootstrap.BezierSignature = function(config){ Roo.extend(Roo.bootstrap.BezierSignature, Roo.bootstrap.Component, { - + curve_data: [], is_empty: true, @@ -41623,7 +41618,7 @@ Roo.extend(Roo.bootstrap.BezierSignature, Roo.bootstrap.Component, velocity_filter_weight: 0.7, /** - * @cfg {function} Callback when stroke begin. + * @cfg {function} Callback when stroke begin. */ onBegin: false, @@ -41805,7 +41800,7 @@ Roo.extend(Roo.bootstrap.BezierSignature, Roo.bootstrap.Component, this.strokeUpdate(e); if (this.throttle) { - this.throttle(this.strokeUpdate, this.throttle); + this.throttleStroke(this.strokeUpdate, this.throttle); } else { this.strokeUpdate(e); @@ -42096,7 +42091,7 @@ Roo.extend(Roo.bootstrap.BezierSignature, Roo.bootstrap.Component, return Bezier; }()), - throttle: function(fn, wait) { + throttleStroke: function(fn, wait) { if (wait === void 0) { wait = 250; } var previous = 0; var timeout = null; diff --git a/roojs-bootstrap.js b/roojs-bootstrap.js index d9493b8fc7..4c536f9409 100644 --- a/roojs-bootstrap.js +++ b/roojs-bootstrap.js @@ -1741,7 +1741,7 @@ this.fileEl().on('change',this.uploadImage,this);this.clear();this.resize();},re var E=parseInt(D.paddingLeft)||0;var F=parseInt(D.paddingRight)||0;A.width=this.el.dom.clientWidth-E-F;if(C){B.putImageData(C,0,0);}},_handleMouseDown:function(e){if(e.browserEvent.which===1){this.mouse_btn_down=true;this.strokeBegin(e);}},_handleMouseMove:function(e){if(this.mouse_btn_down){this.strokeMoveUpdate(e); }},_handleMouseUp:function(e){if(e.browserEvent.which===1&&this.mouse_btn_down){this.mouse_btn_down=false;this.strokeEnd(e);}},_handleTouchStart:function(e){e.preventDefault();if(e.browserEvent.targetTouches.length===1){this.strokeBegin(e);}},_handleTouchMove:function(e){e.preventDefault(); this.strokeMoveUpdate(e);},_handleTouchEnd:function(e){var A=e.target===this.canvasEl().dom;if(A){e.preventDefault();this.strokeEnd(e);}},reset:function(){this._lastPoints=[];this._lastVelocity=0;this._lastWidth=(this.min_width+this.max_width)/2;this.canvasElCtx().fillStyle=this.dot_color; -},strokeMoveUpdate:function(e){this.strokeUpdate(e);if(this.throttle){this.throttle(this.strokeUpdate,this.throttle);}else{this.strokeUpdate(e);}},strokeBegin:function(e){var A={color:this.dot_color,points:[]};if(typeof this.onBegin==='function'){this.onBegin(e); +},strokeMoveUpdate:function(e){this.strokeUpdate(e);if(this.throttle){this.throttleStroke(this.strokeUpdate,this.throttle);}else{this.strokeUpdate(e);}},strokeBegin:function(e){var A={color:this.dot_color,points:[]};if(typeof this.onBegin==='function'){this.onBegin(e); }this.curve_data.push(A);this.reset();this.strokeUpdate(e);},strokeUpdate:function(e){var A=this.canvasEl().dom.getBoundingClientRect();var B=new this.Point(e.xy[0]-A.left,e.xy[1]-A.top,new Date().getTime());var C=this.curve_data[this.curve_data.length-1]; var D=C.points;var E=D.length>0&&D[D.length-1];var F=E?B.distanceTo(E)<=this.min_distance:false;var G=C.color;if(!E||!(E&&F)){var H=this.addPoint(B);if(!E){this.drawDot({color:G,point:B});}else if(H){this.drawCurve({color:G,curve:H});}D.push({time:B.time,x:B.x,y:B.y} );}},strokeEnd:function(e){this.strokeUpdate(e);if(typeof this.onEnd==='function'){this.onEnd(e);}},addPoint:function(A){var B=this._lastPoints;B.push(A);if(B.length>2){if(B.length===3){B.unshift(B[0]);}var C=this.calculateCurveWidths(B[1],B[2]);var D=this.Bezier.fromPoints(B,C,this); @@ -1758,6 +1758,6 @@ A.onload=function(e){var B=new Image();B.onload=function(){this.reset();this.can 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);var F=m1.x-m2.x;var G=m1.y-m2.y;var k=l2/(l1+l2);var cm={x:m2.x+F*k,y:m2.y+G*k};var tx=s2.x-cm.x;var ty=s2.y-cm.y;return {c1:new A.Point(m1.x+tx,m1.y+ty),c2:new A.Point(m2.x+tx,m2.y+ty)} ;};Bezier.prototype.length=function(){var A=10;var B=0;var px;var py;for(var i=0;i<=A;i+=1){var t=i/A;var cx=this.point(t,this.startPoint.x,this.control1.x,this.control2.x,this.endPoint.x);var cy=this.point(t,this.startPoint.y,this.control1.y,this.control2.y,this.endPoint.y); -if(i>0){var C=cx-px;var D=cy-py;B+=Math.sqrt(C*C+D*D);}px=cx;py=cy;}return B;};Bezier.prototype.point=function(t,A,c1,c2,B){return (A*(1.0-t)*(1.0-t)*(1.0-t))+(3.0*c1*(1.0-t)*(1.0-t)*t)+(3.0*c2*(1.0-t)*t*t)+(B*t*t*t);};return Bezier;}()),throttle:function(fn,A){if(A===void 0){A=250; +if(i>0){var C=cx-px;var D=cy-py;B+=Math.sqrt(C*C+D*D);}px=cx;py=cy;}return B;};Bezier.prototype.point=function(t,A,c1,c2,B){return (A*(1.0-t)*(1.0-t)*(1.0-t))+(3.0*c1*(1.0-t)*(1.0-t)*t)+(3.0*c2*(1.0-t)*t*t)+(B*t*t*t);};return Bezier;}()),throttleStroke:function(fn,A){if(A===void 0){A=250; }var B=0;var C=null;var D;var E;var F;var G=function(){B=Date.now();C=null;D=fn.apply(E,F);if(!C){E=null;F=[];}};return function H(){var I=[];for(var _i=0;_iA){if(C){clearTimeout(C); C=null;}B=J;D=fn.apply(E,F);if(!C){E=null;F=[];}}else if(!C){C=window.setTimeout(G,K);}return D;};}}); -- 2.39.2