2021-05-27 15:33:19 -04:00
|
|
|
!function(we){var Se=Math.abs,ze=Math.max,ke=Math.min,Ce=Math.round;function Ae(){return we("<div/>")}we.imgAreaSelect=function(o,n){var t,i,r,c,d,a,s,u,l,h,f,m,e,p,y,g,v,b,x,w,S,z,k,C,A,W,I,K,P=we(o),N=Ae(),H=Ae(),M=Ae().add(Ae()).add(Ae()).add(Ae()),E=Ae().add(Ae()).add(Ae()).add(Ae()),O=we([]),T={left:0,top:0},L={left:0,top:0},j=0,D="absolute",R={x1:0,y1:0,x2:0,y2:0,width:0,height:0},X=document.documentElement,Y=navigator.userAgent;function $(e){return e+T.left-L.left}function q(e){return e+T.top-L.top}function B(e){return e-T.left+L.left}function Q(e){return e-T.top+L.top}function F(e){return ze(e.pageX||0,J(e).x)-L.left}function G(e){return ze(e.pageY||0,J(e).y)-L.top}function J(e){e=e.originalEvent||{};return e.touches&&e.touches.length?{x:e.touches[0].pageX,y:e.touches[0].pageY}:{x:0,y:0}}function U(e){var t=e||h,e=e||f;return{x1:Ce(R.x1*t),y1:Ce(R.y1*e),x2:Ce(R.x2*t),y2:Ce(R.y2*e),width:Ce(R.x2*t)-Ce(R.x1*t),height:Ce(R.y2*e)-Ce(R.y1*e)}}function V(e,t,o,i,s){var n=s||h,s=s||f;(R={x1:Ce(e/n||0),y1:Ce(t/s||0),x2:Ce(o/n||0),y2:Ce(i/s||0)}).width=R.x2-R.x1,R.height=R.y2-R.y1}function Z(){t&&P.width()&&(T={left:Ce(P.offset().left),top:Ce(P.offset().top)},d=P.innerWidth(),a=P.innerHeight(),T.top+=P.outerHeight()-a>>1,T.left+=P.outerWidth()-d>>1,e=Ce(n.minWidth/h)||0,p=Ce(n.minHeight/f)||0,y=Ce(ke(n.maxWidth/h||1<<24,d)),g=Ce(ke(n.maxHeight/f||1<<24,a)),"1.3.2"!=we().jquery||"fixed"!=D||X.getBoundingClientRect||(T.top+=ze(document.body.scrollTop,X.scrollTop),T.left+=ze(document.body.scrollLeft,X.scrollLeft)),L=/absolute|relative/.test(s.css("position"))?{left:Ce(s.offset().left)-s.scrollLeft(),top:Ce(s.offset().top)-s.scrollTop()}:"fixed"==D?{left:we(document).scrollLeft(),top:we(document).scrollTop()}:{left:0,top:0},r=$(0),c=q(0),(R.x2>d||R.y2>a)&&re())}function _(e){if(b){switch(N.css({left:$(R.x1),top:q(R.y1)}).add(H).width(W=R.width).height(I=R.height),H.add(M).add(O).css({left:0,top:0}),M.width(ze(W-M.outerWidth()+M.innerWidth(),0)).height(ze(I-M.outerHeight()+M.innerHeight(),0)),we(E[0]).css({left:r,top:c,width:R.x1,height:a}),we(E[1]).css({left:r+R.x1,top:c,width:W,height:R.y1}),we(E[2]).css({left:r+R.x2,top:c,width:d-R.x2,height:a}),we(E[3]).css({left:r+R.x1,top:c+R.y2,width:W,height:a-R.y2}),W-=O.outerWidth(),I-=O.outerHeight(),O.length){case 8:we(O[4]).css({left:W>>1}),we(O[5]).css({left:W,top:I>>1}),we(O[6]).css({left:W>>1,top:I}),we(O[7]).css({top:I>>1});case 4:O.slice(1,3).css({left:W}),O.slice(2,4).css({top:I})}!1!==e&&(we.imgAreaSelect.onKeyPress!=pe&&we(document).off(we.imgAreaSelect.keyPress,we.imgAreaSelect.onKeyPress),n.keys&&we(document).on(we.imgAreaSelect.keyPress,function(){we.imgAreaSelect.onKeyPress=pe})),ve&&M.outerWidth()-M.innerWidth()==2&&(M.css("margin",0),setTimeout(function(){M.css("margin","auto")},0))}}function ee(e){Z(),_(e),x=$(R.x1),w=q(R.y1),S=$(R.x2),z=q(R.y2)}function te(e,t){n.fadeSpeed?e.fadeOut(n.fadeSpeed,t):e.hide()}function oe(e){var t=B(F(e))-R.x1,e=Q(G(e))-R.y1;K||(Z(),K=!0,N.one("mouseout",function(){K=!1})),m="",n.resizable&&(e<=n.resizeMargin?m="n":e>=R.height-n.resizeMargin&&(m="s"),t<=n.resizeMargin?m+="w":t>=R.width-n.resizeMargin&&(m+="e")),N.css("cursor",m?m+"-resize":n.movable?"move":""),i&&i.toggle()}function ie(e){we("body").css("cursor",""),!n.autoHide&&R.width*R.height!=0||te(N.add(E),function(){we(this).hide()}),we(document).off("mousemove touchmove",ce),N.on("mousemove touchmove",oe),n.onSelectEnd(o,U())}function se(e){return"mousedown"==e.type&&1!=e.which||(oe(e),Z(),m?(we("body").css("cursor",m+"-resize"),x=$(R[/w/.test(m)?"x2":"x1"]),w=q(R[/n/.test(m)?"y2":"y1"]),we(document).on("mousemove touchmove",ce).one("mouseup touchend",ie),N.off("mousemove touchmove",oe)):n.movable?(u=r+R.x1-F(e),l=c+R.y1-G(e),N.off("mousemove touchmove",oe),we(document).on("mousemove touchmove",ae).one("mouseup touchend",function(){n.onSelectEnd(o,U()),we(document).off("mousemove touchmove",ae),N.on("mousemove touchmove",oe)})):P.mousedown(e)),!1}function ne(e){v&&(e?(S=ze(r,ke(r+d,x+Se(z-w)*v*(x<S||-1))),z=Ce(ze(c,ke(c+a,w+Se(S-x)/v*(w<z||-1)))),S=Ce(S)):(z=ze(c,ke(c+a,w+Se(S-
|