//>>built define(["dojo","dijit","dojox","dojo/require!dojox/mobile/app/_Widget,dojo/fx/easing"],function(c,t,l){c.provide("dojox.mobile.app.ImageView");c.experimental("dojox.mobile.app.ImageView");c.require("dojox.mobile.app._Widget");c.require("dojo.fx.easing");c.declare("dojox.mobile.app.ImageView",l.mobile.app._Widget,{zoom:1,zoomCenterX:0,zoomCenterY:0,maxZoom:5,autoZoomLevel:3,disableAutoZoom:!1,disableSwipe:!1,autoZoomEvent:null,_leftImg:null,_centerImg:null,_rightImg:null,_leftSmallImg:null,_centerSmallImg:null, _rightSmallImg:null,constructor:function(){this.panY=this.panX=0;this.handleLoad=c.hitch(this,this.handleLoad);this._updateAnimatedZoom=c.hitch(this,this._updateAnimatedZoom);this._updateAnimatedPan=c.hitch(this,this._updateAnimatedPan);this._onAnimPanEnd=c.hitch(this,this._onAnimPanEnd)},buildRendering:function(){this.inherited(arguments);this.canvas=c.create("canvas",{},this.domNode);c.addClass(this.domNode,"mblImageView")},postCreate:function(){this.inherited(arguments);this.size=c.marginBox(this.domNode); c.style(this.canvas,{width:this.size.w+"px",height:this.size.h+"px"});this.canvas.height=this.size.h;this.canvas.width=this.size.w;var a=this;this.connect(this.domNode,"onmousedown",function(b){a.isAnimating()||(a.panX&&a.handleDragEnd(),a.downX=b.targetTouches?b.targetTouches[0].clientX:b.clientX,a.downY=b.targetTouches?b.targetTouches[0].clientY:b.clientY)});this.connect(this.domNode,"onmousemove",function(b){if(!a.isAnimating()&&(a.downX||0===a.downX)&&(a.downY||0===a.downY)&&(!a.disableSwipe&& 1==a.zoom||!a.disableAutoZoom&&1!=a.zoom)){var d=b.targetTouches?b.targetTouches[0].clientY:b.pageY;a.panX=(b.targetTouches?b.targetTouches[0].clientX:b.pageX)-a.downX;a.panY=d-a.downY;1==a.zoom?10this.panX&&b)?this._animPanTo(0,c.fx.easing.expoOut, 700):this.moveTo(this.panX)}}else if(this.panX||this.panY)this.zoomCenterX-=this.panX/this.zoom,this.zoomCenterY-=this.panY/this.zoom,this.panX=this.panY=0},handleFlick:function(a){1==this.zoom&&500>a.duration&&("ltr"==a.direction?this.moveTo(1):"rtl"==a.direction&&this.moveTo(-1),this.downX=this.downY=null)},moveTo:function(a){a=0a?this._rightImg&&this._rightImg._loaded?b=this._rightImg:this._rightSmallImg&&this._rightSmallImg._loaded&&(b=this._rightSmallImg):this._leftImg&&this._leftImg._loaded? b=this._leftImg:this._leftSmallImg&&this._leftSmallImg._loaded&&(b=this._leftSmallImg);this._moveDir=a;var d=this;b&&b._loaded?this._animPanTo(this.size.w*a,null,500,function(){d.panX=0;d.panY=0;0>a?d._switchImage("left","right"):d._switchImage("right","left");d.render();d.onChange(-1*a)}):(console.log("moveTo image not loaded!",b),this._animPanTo(0,c.fx.easing.expoOut,700))},_switchImage:function(a,b){var d="_"+a+"SmallImg",f="_"+a+"Img",c="_"+b+"SmallImg";b="_"+b+"Img";this[f]=this._centerImg;this[d]= this._centerSmallImg;this[f]._type=a;this[d]&&(this[d]._type=a);this._centerImg=this[b];this._centerSmallImg=this[c];this._centerImg._type="center";this._centerSmallImg&&(this._centerSmallImg._type="center");this[b]=this[c]=null},_animPanTo:function(a,b,d,f){this._animCallback=f;this._anim=new c.Animation({curve:[this.panX,a],onAnimate:this._updateAnimatedPan,duration:d||500,easing:b,onEnd:this._onAnimPanEnd});this._anim.play();return this._anim},onChange:function(a){},_updateAnimatedPan:function(a){this.panX= a;this.render()},_onAnimPanEnd:function(){this.panX=this.panY=0;this._animCallback&&this._animCallback()},zoomTo:function(a,b,d){this.set("zoomCenterX",a);this.set("zoomCenterY",b);this.set("animatedZoom",d)},render:function(){this.canvas.getContext("2d").clearRect(0,0,this.canvas.width,this.canvas.height);this._renderImg(this._centerSmallImg,this._centerImg,1==this.zoom?0>this.panX?1:0this.panX?0d&&(g=Math.max(1,Math.abs(this.panX)-5),k=this.size.w-g):0d&&(g-=Math.abs(this.panX),k=this.size.w-g),c=Math.max(1,Math.floor(g/n*c)),0