diff -r abd11be23718 -r ea0c7ac589c4 src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js Thu Nov 08 10:50:52 2018 +0100 @@ -0,0 +1,1 @@ +(function(b){b.fn.canvasAreaDraw=function(d){this.each(function(e,f){c.apply(f,[e,f,d])})};var c=function(i,o,h){var u,g,x;var p,j,s,q;var l,t,m,r,d,z,y,w,f;var e;var k=false;x=b.extend({imageUrl:b(this).attr("data-image-url")},h);var n=b(o).val().replace(/[^0-9\,]/ig,"");if(n.length){u=n.split(",").map(function(v){return parseInt(v,10)})}else{u=[]}p=b('');j=b("");s=j[0].getContext("2d");q=new Image();z=function(){j.attr("height",q.height).attr("width",q.width);l()};b(q).load(z);q.src=x.imageUrl;if(q.loaded){z()}j.css({background:"url("+q.src+")"});if(o.type!=="hidden"){b(o).after("
")}b(o).after(j,"
",p);y=function(){u=[];l()};r=function(v){if(!v.offsetX){v.offsetX=(v.pageX-b(v.target).offset().left);v.offsetY=(v.pageY-b(v.target).offset().top)}u[g]=Math.round(v.offsetX);u[g+1]=Math.round(v.offsetY);l()};d=function(B){if(!B.offsetX){B.offsetX=(B.pageX-b(B.target).offset().left);B.offsetY=(B.pageY-b(B.target).offset().top)}if(!k){k={x:Math.round(B.offsetX),y:Math.round(B.offsetY)}}var v={x:Math.round(B.offsetX),y:Math.round(B.offsetY)};for(var A=0;A=6){var F=getCenter();s.fillRect(F.x-4,F.y-4,8,8);A=Math.sqrt(Math.pow(v-F.x,2)+Math.pow(G-F.y,2));if(A<6){k=false;b(this).on("mousemove",d);return false}}for(var B=0;B1){D=a(v,G,u[B],u[B+1],u[B-2],u[B-1],true);if(D<6){C=B}}}u.splice(C,0,Math.round(v),Math.round(G));g=C;b(this).on("mousemove",r);l();f();return false};l=function(){s.canvas.width=s.canvas.width;f();if(u.length<2){return}s.globalCompositeOperation="destination-over";s.fillStyle="rgb(255,255,255)";s.strokeStyle="rgb(255,20,20)";s.lineWidth=1;if(u.length>=6){var A=getCenter();s.fillRect(A.x-4,A.y-4,8,8)}s.beginPath();s.moveTo(u[0],u[1]);for(var v=0;v2&&v>1){s.lineTo(u[v],u[v+1])}}s.closePath();s.fillStyle="rgba(255,0,0,0.3)";s.fill();s.stroke()};f=function(){b(o).val(u.join(","))};getCenter=function(){var E=[];for(A=0;A=Math.min(g,e)&&f.x<=Math.max(g,e)&&f.y>=Math.min(q,n)&&f.y<=Math.max(q,n))){var i=d(p,l,g,q),h=d(p,l,e,n);return i>h?h:i}else{var m=q-n,k=e-g,j=g*n-q*e;return Math.abs(m*p+k*l+j)/Math.sqrt(m*m+k*k)}}})(jQuery); \ No newline at end of file