diff -r e202798d3732 -r 82860da48dbb src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js --- a/src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js Fri Nov 09 10:41:05 2018 +0100 +++ b/src/pyams_content/zmi/resources/js/jquery-canvasAreaDraw.min.js Fri Nov 09 15:22:13 2018 +0100 @@ -1,1 +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 +!function(t){t.fn.canvasAreaDraw=function(t){this.each(function(n,f){e.apply(f,[n,f,t])})};var e=function(e,f,a){var o,r,i,s,u,h,l,c,g,p,d,v,m,y,x,M,X=!1;i=t.extend({imageUrl:t(this).attr("data-image-url")},a);var w=t(f).val().replace(/[^0-9\,]/gi,"");o=w.length?w.split(",").map(function(t){return parseInt(t,10)}):[],s=t(''),u=t(""),h=u[0].getContext("2d"),l=new Image,m=function(){u.attr("height",l.height).attr("width",l.width),c()},t(l).load(m),l.src=i.imageUrl,l.loaded&&m(),u.css({background:"url("+l.src+")"}),"hidden"!==f.type&&t(f).after("
"),t(f).after(u,"
",s),y=function(){o=[],c()},d=function(e){e.offsetX||(e.offsetX=e.pageX-t(e.target).offset().left,e.offsetY=e.pageY-t(e.target).offset().top),o[r]=Math.round(e.offsetX),o[r+1]=Math.round(e.offsetY),c()},v=function(e){e.offsetX||(e.offsetX=e.pageX-t(e.target).offset().left,e.offsetY=e.pageY-t(e.target).offset().top),X||(X={x:Math.round(e.offsetX),y:Math.round(e.offsetY)});for(var n={x:Math.round(e.offsetX),y:Math.round(e.offsetY)},f=0;f=6){var s=getCenter();if(h.fillRect(s.x-4,s.y-4,8,8),Math.sqrt(Math.pow(f-s.x,2)+Math.pow(a-s.y,2))<6)return X=!1,t(this).on("mousemove",v),!1}for(u=0;u1&&n(f,a,o[u],o[u+1],o[u-2],o[u-1],!0)<6&&(i=u);return o.splice(i,0,Math.round(f),Math.round(a)),r=i,t(this).on("mousemove",d),c(),M(),!1},c=function(){if(h.canvas.width=h.canvas.width,M(),!(o.length<2)){if(h.globalCompositeOperation="destination-over",h.fillStyle="rgb(255,255,255)",h.strokeStyle="rgb(255,20,20)",h.lineWidth=1,o.length>=6){var t=getCenter();h.fillRect(t.x-4,t.y-4,8,8)}h.beginPath(),h.moveTo(o[0],o[1]);for(var e=0;e2&&e>1&&h.lineTo(o[e],o[e+1]);h.closePath(),h.fillStyle="rgba(255,0,0,0.3)",h.fill(),h.stroke()}},M=function(){t(f).val(o.join(","))},getCenter=function(){var t=[];for(l=0;l=Math.min(n,a)&&r.x<=Math.max(n,a)&&r.y>=Math.min(f,o)&&r.y<=Math.max(f,o)){var s=f-o,u=a-n,h=n*o-f*a;return Math.abs(s*t+u*e+h)/Math.sqrt(s*s+u*u)}var l=i(t,e,n,f),c=i(t,e,a,o);return l>c?c:l}}(jQuery);