-
+ 2BF793302337C1FD67AEA0247024AC417B08296BD55F6D3F1D2B1850FBAA4648ADDA2C4B2B299469E909E3C44B146BED46D0F5EC18041B36055915896288B82Bmp-wp/wp-includes/js/crop/cropper.js(0 . 0)(1 . 516)
100510 /**
100511 * Copyright (c) 2006, David Spurr (http://www.defusion.org.uk/)
100512 * All rights reserved.
100513 *
100514 * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
100515 *
100516 * * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
100517 * * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
100518 * * Neither the name of the David Spurr nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
100519 *
100520 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
100521 *
100522 * http://www.opensource.org/licenses/bsd-license.php
100523 *
100524 * See scriptaculous.js for full scriptaculous licence
100525 */
100526
100527 var CropDraggable=Class.create();
100528 Object.extend(Object.extend(CropDraggable.prototype,Draggable.prototype),{initialize:function(_1){
100529 this.options=Object.extend({drawMethod:function(){
100530 }},arguments[1]||{});
100531 this.element=$(_1);
100532 this.handle=this.element;
100533 this.delta=this.currentDelta();
100534 this.dragging=false;
100535 this.eventMouseDown=this.initDrag.bindAsEventListener(this);
100536 Event.observe(this.handle,"mousedown",this.eventMouseDown);
100537 Draggables.register(this);
100538 },draw:function(_2){
100539 var _3=Position.cumulativeOffset(this.element);
100540 var d=this.currentDelta();
100541 _3[0]-=d[0];
100542 _3[1]-=d[1];
100543 var p=[0,1].map(function(i){
100544 return (_2[i]-_3[i]-this.offset[i]);
100545 }.bind(this));
100546 this.options.drawMethod(p);
100547 }});
100548 var Cropper={};
100549 Cropper.Img=Class.create();
100550 Cropper.Img.prototype={initialize:function(_7,_8){
100551 this.options=Object.extend({ratioDim:{x:0,y:0},minWidth:0,minHeight:0,displayOnInit:false,onEndCrop:Prototype.emptyFunction,captureKeys:true},_8||{});
100552 if(this.options.minWidth>0&&this.options.minHeight>0){
100553 this.options.ratioDim.x=this.options.minWidth;
100554 this.options.ratioDim.y=this.options.minHeight;
100555 }
100556 this.img=$(_7);
100557 this.clickCoords={x:0,y:0};
100558 this.dragging=false;
100559 this.resizing=false;
100560 this.isWebKit=/Konqueror|Safari|KHTML/.test(navigator.userAgent);
100561 this.isIE=/MSIE/.test(navigator.userAgent);
100562 this.isOpera8=/Opera\s[1-8]/.test(navigator.userAgent);
100563 this.ratioX=0;
100564 this.ratioY=0;
100565 this.attached=false;
100566 $A(document.getElementsByTagName("script")).each(function(s){
100567 if(s.src.match(/cropper\.js/)){
100568 var _a=s.src.replace(/cropper\.js(.*)?/,"");
100569 var _b=document.createElement("link");
100570 _b.rel="stylesheet";
100571 _b.type="text/css";
100572 _b.href=_a+"cropper.css";
100573 _b.media="screen";
100574 document.getElementsByTagName("head")[0].appendChild(_b);
100575 }
100576 });
100577 if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0){
100578 var _c=this.getGCD(this.options.ratioDim.x,this.options.ratioDim.y);
100579 this.ratioX=this.options.ratioDim.x/_c;
100580 this.ratioY=this.options.ratioDim.y/_c;
100581 }
100582 this.subInitialize();
100583 if(this.img.complete||this.isWebKit){
100584 this.onLoad();
100585 }else{
100586 Event.observe(this.img,"load",this.onLoad.bindAsEventListener(this));
100587 }
100588 },getGCD:function(a,b){return 1;
100589 if(b==0){
100590 return a;
100591 }
100592 return this.getGCD(b,a%b);
100593 },onLoad:function(){
100594 var _f="imgCrop_";
100595 var _10=this.img.parentNode;
100596 var _11="";
100597 if(this.isOpera8){
100598 _11=" opera8";
100599 }
100600 this.imgWrap=Builder.node("div",{"class":_f+"wrap"+_11});
100601 if(this.isIE){
100602 this.north=Builder.node("div",{"class":_f+"overlay "+_f+"north"},[Builder.node("span")]);
100603 this.east=Builder.node("div",{"class":_f+"overlay "+_f+"east"},[Builder.node("span")]);
100604 this.south=Builder.node("div",{"class":_f+"overlay "+_f+"south"},[Builder.node("span")]);
100605 this.west=Builder.node("div",{"class":_f+"overlay "+_f+"west"},[Builder.node("span")]);
100606 var _12=[this.north,this.east,this.south,this.west];
100607 }else{
100608 this.overlay=Builder.node("div",{"class":_f+"overlay"});
100609 var _12=[this.overlay];
100610 }
100611 this.dragArea=Builder.node("div",{"class":_f+"dragArea"},_12);
100612 this.handleN=Builder.node("div",{"class":_f+"handle "+_f+"handleN"});
100613 this.handleNE=Builder.node("div",{"class":_f+"handle "+_f+"handleNE"});
100614 this.handleE=Builder.node("div",{"class":_f+"handle "+_f+"handleE"});
100615 this.handleSE=Builder.node("div",{"class":_f+"handle "+_f+"handleSE"});
100616 this.handleS=Builder.node("div",{"class":_f+"handle "+_f+"handleS"});
100617 this.handleSW=Builder.node("div",{"class":_f+"handle "+_f+"handleSW"});
100618 this.handleW=Builder.node("div",{"class":_f+"handle "+_f+"handleW"});
100619 this.handleNW=Builder.node("div",{"class":_f+"handle "+_f+"handleNW"});
100620 this.selArea=Builder.node("div",{"class":_f+"selArea"},[Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeNorth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeEast"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeHoriz "+_f+"marqueeSouth"},[Builder.node("span")]),Builder.node("div",{"class":_f+"marqueeVert "+_f+"marqueeWest"},[Builder.node("span")]),this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW,Builder.node("div",{"class":_f+"clickArea"})]);
100621 Element.setStyle($(this.selArea),{backgroundColor:"transparent",backgroundRepeat:"no-repeat",backgroundPosition:"0 0"});
100622 this.imgWrap.appendChild(this.img);
100623 this.imgWrap.appendChild(this.dragArea);
100624 this.dragArea.appendChild(this.selArea);
100625 this.dragArea.appendChild(Builder.node("div",{"class":_f+"clickArea"}));
100626 _10.appendChild(this.imgWrap);
100627 Event.observe(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this));
100628 Event.observe(document,"mousemove",this.onDrag.bindAsEventListener(this));
100629 Event.observe(document,"mouseup",this.endCrop.bindAsEventListener(this));
100630 var _13=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];
100631 for(var i=0;i<_13.length;i++){
100632 Event.observe(_13[i],"mousedown",this.startResize.bindAsEventListener(this));
100633 }
100634 if(this.options.captureKeys){
100635 Event.observe(document,"keydown",this.handleKeys.bindAsEventListener(this));
100636 }
100637 new CropDraggable(this.selArea,{drawMethod:this.moveArea.bindAsEventListener(this)});
100638 this.setParams();
100639 },setParams:function(){
100640 this.imgW=this.img.width;
100641 this.imgH=this.img.height;
100642 if(!this.isIE){
100643 Element.setStyle($(this.overlay),{width:this.imgW+"px",height:this.imgH+"px"});
100644 Element.hide($(this.overlay));
100645 Element.setStyle($(this.selArea),{backgroundImage:"url("+this.img.src+")"});
100646 }else{
100647 Element.setStyle($(this.north),{height:0});
100648 Element.setStyle($(this.east),{width:0,height:0});
100649 Element.setStyle($(this.south),{height:0});
100650 Element.setStyle($(this.west),{width:0,height:0});
100651 }
100652 Element.setStyle($(this.imgWrap),{"width":this.imgW+"px","height":this.imgH+"px"});
100653 Element.hide($(this.selArea));
100654 var _15=Position.positionedOffset(this.imgWrap);
100655 this.wrapOffsets={"top":_15[1],"left":_15[0]};
100656 var _16={x1:0,y1:0,x2:0,y2:0};
100657 this.setAreaCoords(_16);
100658 if(this.options.ratioDim.x>0&&this.options.ratioDim.y>0&&this.options.displayOnInit){
100659 _16.x1=Math.ceil((this.imgW-this.options.ratioDim.x)/2);
100660 _16.y1=Math.ceil((this.imgH-this.options.ratioDim.y)/2);
100661 _16.x2=_16.x1+this.options.ratioDim.x;
100662 _16.y2=_16.y1+this.options.ratioDim.y;
100663 Element.show(this.selArea);
100664 this.drawArea();
100665 this.endCrop();
100666 }
100667 this.attached=true;
100668 },remove:function(){
100669 this.attached=false;
100670 this.imgWrap.parentNode.insertBefore(this.img,this.imgWrap);
100671 this.imgWrap.parentNode.removeChild(this.imgWrap);
100672 Event.stopObserving(this.dragArea,"mousedown",this.startDrag.bindAsEventListener(this));
100673 Event.stopObserving(document,"mousemove",this.onDrag.bindAsEventListener(this));
100674 Event.stopObserving(document,"mouseup",this.endCrop.bindAsEventListener(this));
100675 var _17=[this.handleN,this.handleNE,this.handleE,this.handleSE,this.handleS,this.handleSW,this.handleW,this.handleNW];
100676 for(var i=0;i<_17.length;i++){
100677 Event.stopObserving(_17[i],"mousedown",this.startResize.bindAsEventListener(this));
100678 }
100679 if(this.options.captureKeys){
100680 Event.stopObserving(document,"keydown",this.handleKeys.bindAsEventListener(this));
100681 }
100682 },reset:function(){
100683 if(!this.attached){
100684 this.onLoad();
100685 }else{
100686 this.setParams();
100687 }
100688 this.endCrop();
100689 },handleKeys:function(e){
100690 var dir={x:0,y:0};
100691 if(!this.dragging){
100692 switch(e.keyCode){
100693 case (37):
100694 dir.x=-1;
100695 break;
100696 case (38):
100697 dir.y=-1;
100698 break;
100699 case (39):
100700 dir.x=1;
100701 break;
100702 case (40):
100703 dir.y=1;
100704 break;
100705 }
100706 if(dir.x!=0||dir.y!=0){
100707 if(e.shiftKey){
100708 dir.x*=10;
100709 dir.y*=10;
100710 }
100711 this.moveArea([this.areaCoords.x1+dir.x,this.areaCoords.y1+dir.y]);
100712 Event.stop(e);
100713 }
100714 }
100715 },calcW:function(){
100716 return (this.areaCoords.x2-this.areaCoords.x1);
100717 },calcH:function(){
100718 return (this.areaCoords.y2-this.areaCoords.y1);
100719 },moveArea:function(_1b){
100720 this.setAreaCoords({x1:_1b[0],y1:_1b[1],x2:_1b[0]+this.calcW(),y2:_1b[1]+this.calcH()},true);
100721 this.drawArea();
100722 },cloneCoords:function(_1c){
100723 return {x1:_1c.x1,y1:_1c.y1,x2:_1c.x2,y2:_1c.y2};
100724 },setAreaCoords:function(_1d,_1e,_1f,_20,_21){
100725 var _22=typeof _1e!="undefined"?_1e:false;
100726 var _23=typeof _1f!="undefined"?_1f:false;
100727 if(_1e){
100728 var _24=_1d.x2-_1d.x1;
100729 var _25=_1d.y2-_1d.y1;
100730 if(_1d.x1<0){
100731 _1d.x1=0;
100732 _1d.x2=_24;
100733 }
100734 if(_1d.y1<0){
100735 _1d.y1=0;
100736 _1d.y2=_25;
100737 }
100738 if(_1d.x2>this.imgW){
100739 _1d.x2=this.imgW;
100740 _1d.x1=this.imgW-_24;
100741 }
100742 if(_1d.y2>this.imgH){
100743 _1d.y2=this.imgH;
100744 _1d.y1=this.imgH-_25;
100745 }
100746 }else{
100747 if(_1d.x1<0){
100748 _1d.x1=0;
100749 }
100750 if(_1d.y1<0){
100751 _1d.y1=0;
100752 }
100753 if(_1d.x2>this.imgW){
100754 _1d.x2=this.imgW;
100755 }
100756 if(_1d.y2>this.imgH){
100757 _1d.y2=this.imgH;
100758 }
100759 if(typeof (_20)!="undefined"){
100760 if(this.ratioX>0){
100761 this.applyRatio(_1d,{x:this.ratioX,y:this.ratioY},_20,_21);
100762 }else{
100763 if(_23){
100764 this.applyRatio(_1d,{x:1,y:1},_20,_21);
100765 }
100766 }
100767 var _26={a1:_1d.x1,a2:_1d.x2};
100768 var _27={a1:_1d.y1,a2:_1d.y2};
100769 var _28=this.options.minWidth;
100770 var _29=this.options.minHeight;
100771 if((_28==0||_29==0)&&_23){
100772 if(_28>0){
100773 _29=_28;
100774 }else{
100775 if(_29>0){
100776 _28=_29;
100777 }
100778 }
100779 }
100780 this.applyMinDimension(_26,_28,_20.x,{min:0,max:this.imgW});
100781 this.applyMinDimension(_27,_29,_20.y,{min:0,max:this.imgH});
100782 _1d={x1:_26.a1,y1:_27.a1,x2:_26.a2,y2:_27.a2};
100783 }
100784 }
100785 this.areaCoords=_1d;
100786 },applyMinDimension:function(_2a,_2b,_2c,_2d){
100787 if((_2a.a2-_2a.a1)<_2b){
100788 if(_2c==1){
100789 _2a.a2=_2a.a1+_2b;
100790 }else{
100791 _2a.a1=_2a.a2-_2b;
100792 }
100793 if(_2a.a1<_2d.min){
100794 _2a.a1=_2d.min;
100795 _2a.a2=_2b;
100796 }else{
100797 if(_2a.a2>_2d.max){
100798 _2a.a1=_2d.max-_2b;
100799 _2a.a2=_2d.max;
100800 }
100801 }
100802 }
100803 },applyRatio:function(_2e,_2f,_30,_31){
100804 var _32;
100805 if(_31=="N"||_31=="S"){
100806 _32=this.applyRatioToAxis({a1:_2e.y1,b1:_2e.x1,a2:_2e.y2,b2:_2e.x2},{a:_2f.y,b:_2f.x},{a:_30.y,b:_30.x},{min:0,max:this.imgW});
100807 _2e.x1=_32.b1;
100808 _2e.y1=_32.a1;
100809 _2e.x2=_32.b2;
100810 _2e.y2=_32.a2;
100811 }else{
100812 _32=this.applyRatioToAxis({a1:_2e.x1,b1:_2e.y1,a2:_2e.x2,b2:_2e.y2},{a:_2f.x,b:_2f.y},{a:_30.x,b:_30.y},{min:0,max:this.imgH});
100813 _2e.x1=_32.a1;
100814 _2e.y1=_32.b1;
100815 _2e.x2=_32.a2;
100816 _2e.y2=_32.b2;
100817 }
100818 },applyRatioToAxis:function(_33,_34,_35,_36){
100819 var _37=Object.extend(_33,{});
100820 var _38=_37.a2-_37.a1;
100821 var _3a=Math.floor(_38*_34.b/_34.a);
100822 var _3b;
100823 var _3c;
100824 var _3d=null;
100825 if(_35.b==1){
100826 _3b=_37.b1+_3a;
100827 if(_3b>_36.max){
100828 _3b=_36.max;
100829 _3d=_3b-_37.b1;
100830 }
100831 _37.b2=_3b;
100832 }else{
100833 _3b=_37.b2-_3a;
100834 if(_3b<_36.min){
100835 _3b=_36.min;
100836 _3d=_3b+_37.b2;
100837 }
100838 _37.b1=_3b;
100839 }
100840 if(_3d!=null){
100841 _3c=Math.floor(_3d*_34.a/_34.b);
100842 if(_35.a==1){
100843 _37.a2=_37.a1+_3c;
100844 }else{
100845 _37.a1=_37.a1=_37.a2-_3c;
100846 }
100847 }
100848 return _37;
100849 },drawArea:function(){
100850 if(!this.isIE){
100851 Element.show($(this.overlay));
100852 }
100853 var _3e=this.calcW();
100854 var _3f=this.calcH();
100855 var _40=this.areaCoords.x2;
100856 var _41=this.areaCoords.y2;
100857 var _42=this.selArea.style;
100858 _42.left=this.areaCoords.x1+"px";
100859 _42.top=this.areaCoords.y1+"px";
100860 _42.width=_3e+"px";
100861 _42.height=_3f+"px";
100862 var _43=Math.ceil((_3e-6)/2)+"px";
100863 var _44=Math.ceil((_3f-6)/2)+"px";
100864 this.handleN.style.left=_43;
100865 this.handleE.style.top=_44;
100866 this.handleS.style.left=_43;
100867 this.handleW.style.top=_44;
100868 if(this.isIE){
100869 this.north.style.height=this.areaCoords.y1+"px";
100870 var _45=this.east.style;
100871 _45.top=this.areaCoords.y1+"px";
100872 _45.height=_3f+"px";
100873 _45.left=_40+"px";
100874 _45.width=(this.img.width-_40)+"px";
100875 var _46=this.south.style;
100876 _46.top=_41+"px";
100877 _46.height=(this.img.height-_41)+"px";
100878 var _47=this.west.style;
100879 _47.top=this.areaCoords.y1+"px";
100880 _47.height=_3f+"px";
100881 _47.width=this.areaCoords.x1+"px";
100882 }else{
100883 _42.backgroundPosition="-"+this.areaCoords.x1+"px "+"-"+this.areaCoords.y1+"px";
100884 }
100885 this.subDrawArea();
100886 this.forceReRender();
100887 },forceReRender:function(){
100888 if(this.isIE||this.isWebKit){
100889 var n=document.createTextNode(" ");
100890 var d,el,fixEL,i;
100891 if(this.isIE){
100892 fixEl=this.selArea;
100893 }else{
100894 if(this.isWebKit){
100895 fixEl=document.getElementsByClassName("imgCrop_marqueeSouth",this.imgWrap)[0];
100896 d=Builder.node("div","");
100897 d.style.visibility="hidden";
100898 var _4a=["SE","S","SW"];
100899 for(i=0;i<_4a.length;i++){
100900 el=document.getElementsByClassName("imgCrop_handle"+_4a[i],this.selArea)[0];
100901 if(el.childNodes.length){
100902 el.removeChild(el.childNodes[0]);
100903 }
100904 el.appendChild(d);
100905 }
100906 }
100907 }
100908 fixEl.appendChild(n);
100909 fixEl.removeChild(n);
100910 }
100911 },startResize:function(e){
100912 this.startCoords=this.cloneCoords(this.areaCoords);
100913 this.resizing=true;
100914 this.resizeHandle=Element.classNames(Event.element(e)).toString().replace(/([^N|NE|E|SE|S|SW|W|NW])+/,"");
100915 Event.stop(e);
100916 },startDrag:function(e){
100917 Element.show(this.selArea);
100918 this.clickCoords=this.getCurPos(e);
100919 this.setAreaCoords({x1:this.clickCoords.x,y1:this.clickCoords.y,x2:this.clickCoords.x,y2:this.clickCoords.y});
100920 this.dragging=true;
100921 this.onDrag(e);
100922 Event.stop(e);
100923 },getCurPos:function(e){
100924 return curPos={x:Event.pointerX(e)-this.wrapOffsets.left,y:Event.pointerY(e)-this.wrapOffsets.top};
100925 },onDrag:function(e){
100926 var _4f=null;
100927 if(this.dragging||this.resizing){
100928 var _50=this.getCurPos(e);
100929 var _51=this.cloneCoords(this.areaCoords);
100930 var _52={x:1,y:1};
100931 }
100932 if(this.dragging){
100933 if(_50.x<this.clickCoords.x){
100934 _52.x=-1;
100935 }
100936 if(_50.y<this.clickCoords.y){
100937 _52.y=-1;
100938 }
100939 this.transformCoords(_50.x,this.clickCoords.x,_51,"x");
100940 this.transformCoords(_50.y,this.clickCoords.y,_51,"y");
100941 }else{
100942 if(this.resizing){
100943 _4f=this.resizeHandle;
100944 if(_4f.match(/E/)){
100945 this.transformCoords(_50.x,this.startCoords.x1,_51,"x");
100946 if(_50.x<this.startCoords.x1){
100947 _52.x=-1;
100948 }
100949 }else{
100950 if(_4f.match(/W/)){
100951 this.transformCoords(_50.x,this.startCoords.x2,_51,"x");
100952 if(_50.x<this.startCoords.x2){
100953 _52.x=-1;
100954 }
100955 }
100956 }
100957 if(_4f.match(/N/)){
100958 this.transformCoords(_50.y,this.startCoords.y2,_51,"y");
100959 if(_50.y<this.startCoords.y2){
100960 _52.y=-1;
100961 }
100962 }else{
100963 if(_4f.match(/S/)){
100964 this.transformCoords(_50.y,this.startCoords.y1,_51,"y");
100965 if(_50.y<this.startCoords.y1){
100966 _52.y=-1;
100967 }
100968 }
100969 }
100970 }
100971 }
100972 if(this.dragging||this.resizing){
100973 this.setAreaCoords(_51,false,e.shiftKey,_52,_4f);
100974 this.drawArea();
100975 Event.stop(e);
100976 }
100977 },transformCoords:function(_53,_54,_55,_56){
100978 var _57=new Array();
100979 if(_53<_54){
100980 _57[0]=_53;
100981 _57[1]=_54;
100982 }else{
100983 _57[0]=_54;
100984 _57[1]=_53;
100985 }
100986 if(_56=="x"){
100987 _55.x1=_57[0];
100988 _55.x2=_57[1];
100989 }else{
100990 _55.y1=_57[0];
100991 _55.y2=_57[1];
100992 }
100993 },endCrop:function(){
100994 this.dragging=false;
100995 this.resizing=false;
100996 this.options.onEndCrop(this.areaCoords,{width:this.calcW(),height:this.calcH()});
100997 },subInitialize:function(){
100998 },subDrawArea:function(){
100999 }};
101000 Cropper.ImgWithPreview=Class.create();
101001 Object.extend(Object.extend(Cropper.ImgWithPreview.prototype,Cropper.Img.prototype),{subInitialize:function(){
101002 this.hasPreviewImg=false;
101003 if(typeof (this.options.previewWrap)!="undefined"&&this.options.minWidth>0&&this.options.minHeight>0){
101004 this.previewWrap=$(this.options.previewWrap);
101005 this.previewImg=this.img.cloneNode(false);
101006 this.options.displayOnInit=true;
101007 this.hasPreviewImg=true;
101008 Element.addClassName(this.previewWrap,"imgCrop_previewWrap");
101009 Element.setStyle(this.previewWrap,{width:this.options.minWidth+"px",height:this.options.minHeight+"px"});
101010 this.previewWrap.appendChild(this.previewImg);
101011 }
101012 },subDrawArea:function(){
101013 if(this.hasPreviewImg){
101014 var _58=this.calcW();
101015 var _59=this.calcH();
101016 var _5a={x:this.imgW/_58,y:this.imgH/_59};
101017 var _5b={x:_58/this.options.minWidth,y:_59/this.options.minHeight};
101018 var _5c={w:Math.ceil(this.options.minWidth*_5a.x)+"px",h:Math.ceil(this.options.minHeight*_5a.y)+"px",x:"-"+Math.ceil(this.areaCoords.x1/_5b.x)+"px",y:"-"+Math.ceil(this.areaCoords.y1/_5b.y)+"px"};
101019 var _5d=this.previewImg.style;
101020 _5d.width=_5c.w;
101021 _5d.height=_5c.h;
101022 _5d.left=_5c.x;
101023 _5d.top=_5c.y;
101024 }
101025 }});