var DvtHandleManager=function(a){this.Init(a)};DvtObj.createSubclass(DvtHandleManager,DvtObj,"DvtHandleManager");DvtHandleManager.C_SCROLL="s";DvtHandleManager.C_RESIZE="r";DvtHandleManager.SCROLL_START="__START__";DvtHandleManager.SCROLL_SPAN="__SPAN__";DvtHandleManager.SCROLL_TOTAL="__TOTAL__";DvtHandleManager.TOK_TYPE="__T__";
DvtHandleManager.prototype.Init=function(a){this._Chart=a;this._handleList=[];this._fullPlotPoints=this._o1rs=this._y2rs=this._y1rs=this._x1rs=this._hY2L=this._hY1L=this._hOL=this._hY2PA=this._hY1PA=this._hX1L=this._hPA=null;this._fullPlotHeight=this._fullPlotWidth=0;this._fullPlotPointsY2=null;this._fullPlotHeightY2=this._fullPlotWidthY2=0;a.addEvtListener(DvtMouseEvent.MOUSEUP,this.onGlobalMouseUp,!1,this)};
DvtHandleManager.prototype.addHandle=function(a){this._handleList.push(a);switch(a.getId()){case DvtGraphHandle.ID_PA:this._hPA=a;break;case DvtGraphHandle.ID_X1L:this._hX1L=a;break;case DvtGraphHandle.ID_Y1PA:this._hY1PA=a;break;case DvtGraphHandle.ID_Y2PA:this._hY2PA=a;break;case DvtGraphHandle.ID_OL:this._hOL=a;break;case DvtGraphHandle.ID_Y1L:this._hY1L=a;break;case DvtGraphHandle.ID_Y2L:this._hY2L=a}a.getId()==DvtGraphHandle.ID_PA&&null!=a.getBoundingPoints()?(this._fullPlotPoints=a.getBoundingPoints(),
this._fullPlotWidth=this._fullPlotPoints[2]-this._fullPlotPoints[0],this._fullPlotHeight=this._fullPlotPoints[3]-this._fullPlotPoints[1]):a.getId()==DvtGraphHandle.ID_Y2PA&&null!=a.getBoundingPoints()&&(this._fullPlotPointsY2=a.getBoundingPoints(),this._fullPlotWidthY2=this._fullPlotPointsY2[2]-this._fullPlotPointsY2[0],this._fullPlotHeightY2=this._fullPlotPointsY2[3]-this._fullPlotPointsY2[1])};
DvtHandleManager.prototype.addScrollbar=function(a){var b=a.getScrollbarThumb();DvtGraphSysUtils.makeDetObject(b,a._Dlo._Chart);switch(a._uiId){case DvtScrollbar.ID_X1RS:this._x1rs=a;break;case DvtScrollbar.ID_Y1RS:this._y1rs=a;break;case DvtScrollbar.ID_Y2RS:this._y2rs=a;break;case DvtScrollbar.ID_O1RS:this._o1rs=a}a.addEvtListener(DvtScrollbarEvent.SB_MOVE,this.onScrollbarMove,!1,this);a.addEvtListener(DvtScrollbarEvent.SB_MOVE_COMPLETE,this.onScrollbarMoveComplete,!1,this);a.addEvtListener(DvtScrollbarEvent.SB_RESIZE_COMPLETE,
this.onScrollbarResizeComplete,!1,this)};DvtHandleManager.prototype.hasScrollbars=function(){return this._o1rs||this._x1rs||this._y1rs||this._y2rs?!0:!1};DvtHandleManager.prototype.onGlobalMouseUp=function(a){this._o1rs&&this._o1rs.processGlobalMouseUp();this._x1rs&&this._x1rs.processGlobalMouseUp();this._y1rs&&this._y1rs.processGlobalMouseUp();this._y2rs&&this._y2rs.processGlobalMouseUp()};
DvtHandleManager.prototype.onScrollbarMove=function(a){var b=a.getMovedDelta();if(a.type==DvtScrollbarEvent.SB_MOVE&&0!=b){this._Chart.isMagnifyLensEnabled()&&this._Chart.getCtx().getCustomTooltipManager().getMagnifyLens().setDirty(!0);var c=a.getScaledDelta(),b=a.getScrollbar(),d=this._fullPlotWidth,e=this._fullPlotHeight;b.getUIId()==DvtScrollbar.ID_Y2RS&&(d=this._fullPlotWidthY2,e=this._fullPlotHeightY2);c=b.isHorizontal()?c*d:c*e;c=0<c?Math.ceil(c):Math.floor(c);switch(a.getScrollbarId()){case DvtScrollbar.ID_X1RS:this._scrollXAxis(c,
b);break;case DvtScrollbar.ID_O1RS:this._scrollOAxis(c,b);break;case DvtScrollbar.ID_Y1RS:this._scrollYAxis(c,b);break;case DvtScrollbar.ID_Y2RS:this._scrollY2Axis(c,b)}}};DvtHandleManager.prototype.onScrollbarMoveComplete=function(a){this._emitMTEvent(a)};DvtHandleManager.prototype.onScrollbarResizeComplete=function(a){this._emitMTEvent(a)};
DvtHandleManager.prototype._emitMTEvent=function(a){var b=a.getScrollbar(),c,d;a.type==DvtScrollbarEvent.SB_MOVE_COMPLETE?(d=DvtHandleManager.C_SCROLL,c=b.getScrollEventJs()):a.type==DvtScrollbarEvent.SB_RESIZE_COMPLETE&&(d=DvtHandleManager.C_RESIZE,c=b.getZoomEventJs());if(c){var e=a.getStartCoord();a=a.getEndCoord()-e;var f=b.getScrollAreaLength();b.isHorizontal()||(e=f-a-e);var g=c.replace(DvtHandleManager.SCROLL_START,e).replace(DvtHandleManager.SCROLL_SPAN,a).replace(DvtHandleManager.SCROLL_TOTAL,
f).replace(DvtHandleManager.TOK_TYPE,d).match(/'(.*?)'/g),b=g[0].replace(/\'/g,"");c=g[2].replace(/\'/g,"");d=g[3].replace(/\'/g,"");e=g[4].replace(/\'/g,"");a=g[5].replace(/\'/g,"");f=g[6].replace(/\'/g,"");g=g[7].replace(/\'/g,"");AdfPage.PAGE.findComponent(b).getPeer().sendToServerPPR2({source:b,event:c,bi_gdsA:d,bi_gdsSt:e,bi_gdsSp:a,bi_gdsC:f,bi_gdsT:g})}};
DvtHandleManager.prototype._scrollOAxis=function(a,b){if(null!=this._hPA&&null!=this._hPA.getBoundingPoints()){var c=this._hPA.getBoundingPoints(),d=this._Chart.getFrameRect();b.isHorizontal()?(c=this._getBoundedOffset(a,c[0],c[2],d.x,d.x+d.w),this._hPA.moveX(-c),null!=this._hOL&&this._hOL.moveX(-c),null!=this._hY2PA&&this._hY2PA.moveX(-c)):(c=this._getBoundedOffset(a,c[1],c[3],d.y,d.y+d.h),this._hPA.moveY(-c),null!=this._hOL&&this._hOL.moveY(-c),null!=this._hY2PA&&this._hY2PA.moveY(-c))}};
DvtHandleManager.prototype._scrollXAxis=function(a,b){if(null!=this._hPA&&null!=this._hPA.getBoundingPoints()){var c=this._hPA.getBoundingPoints(),d=this._Chart.getFrameRect();b.isHorizontal()?(c=this._getBoundedOffset(a,c[0],c[2],d.x,d.x+d.w),this._hPA.moveX(-c),null!=this._hX1L&&this._hX1L.moveX(-c),null!=this._hY2PA&&this._hY2PA.moveX(-c)):(c=this._getBoundedOffset(a,c[1],c[3],d.y,d.y+d.h),this._hPA.moveY(-c),null!=this._hX1L&&this._hX1L.moveY(-c),null!=this._hY2PA&&this._hY2PA.moveY(-c))}};
DvtHandleManager.prototype._scrollYAxis=function(a,b){if(null!=this._hPA&&null!=this._hPA.getBoundingPoints()){var c=this._hPA.getBoundingPoints(),d=this._hPA.getClipRect();null!=d&&(b.isHorizontal()?(c=this._getBoundedOffset(a,c[0],c[2],d.x,d.x+d.w),this._hPA.moveX(-c),null!=this._hY1L&&this._hY1L.moveX(-c)):(c=this._getBoundedOffset(a,c[1],c[3],d.y,d.y+d.h),this._hPA.moveY(-c),null!=this._hY1L&&this._hY1L.moveY(-c)))}};
DvtHandleManager.prototype._scrollY2Axis=function(a,b){if(null!=this._hY2PA&&null!=this._hY2PA.getBoundingPoints()){var c=this._hY2PA.getBoundingPoints(),d=this._hY2PA.getClipRect();null!=d&&(b.isHorizontal()?(c=this._getBoundedOffset(a,c[0],c[2],d.x,d.x+d.w),this._hY2PA.moveX(-c),null!=this._hY2L&&this._hY2L.moveX(-c)):(c=this._getBoundedOffset(a,c[1],c[3],d.y,d.y+d.h),this._hY2PA.moveY(-c),null!=this._hY2L&&this._hY2L.moveY(-c)))}};
DvtHandleManager.prototype._getBoundedOffset=function(a,b,c,d,e){var f=a;b-a>=d?f=b-d:e>c-a&&(f=c-e);return f};
DvtHandleManager.prototype.scrollPlotAreaOffset=function(a,b,c,d,e,f,g){var h=0,k=0,m=0,n=0;0!=a&&null!=this._o1rs&&(h=this._o1rs.isHorizontal()?100*a/this._fullPlotWidth:100*a/this._fullPlotHeight);0!=b&&null!=this._x1rs&&(k=this._x1rs.isHorizontal()?100*b/this._fullPlotWidth:100*b/this._fullPlotHeight);0!=c&&null!=this._y1rs&&(m=this._hPA.getClipRect(),null!=e&&null!=m&&(e.x<m.x||e.x>m.x+m.width||e.y<m.y||e.y>m.y+m.height)&&(c=0),m=this._y1rs.isHorizontal()?100*c/this._fullPlotWidth:100*c/this._fullPlotHeight);
0!=d&&null!=this._y2rs&&(c=this._hY2PA.getClipRect(),null!=e&&null!=c&&(e.x<c.x||e.x>c.x+c.width||e.y<c.y||e.y>c.y+c.height)&&(d=0),n=this._y2rs.isHorizontal()?100*d/this._fullPlotWidthY2:100*d/this._fullPlotHeightY2);this.scrollPlotAreaPercentage(h,k,m,n,f,g)};
DvtHandleManager.prototype.scrollPlotAreaPercentage=function(a,b,c,d,e,f){var g=null;0!=a&&null!=this._o1rs&&(g=this._o1rs.isHorizontal()?a/100*this._fullPlotWidth:a/100*this._fullPlotHeight,this._scrollOAxis(g,this._o1rs),this._o1rs.move(a,e,f));0!=b&&null!=this._x1rs&&(g=this._x1rs.isHorizontal()?b/100*this._fullPlotWidth:b/100*this._fullPlotHeight,this._scrollXAxis(g,this._x1rs),this._x1rs.move(b,e,f));0!=c&&null!=this._y1rs&&(g=this._y1rs.isHorizontal()?c/100*this._fullPlotWidth:c/100*this._fullPlotHeight,
this._scrollYAxis(g,this._y1rs),this._y1rs.move(c,e,f));0!=d&&null!=this._y2rs&&(g=this._y2rs.isHorizontal()?d/100*this._fullPlotWidthY2:d/100*this._fullPlotHeightY2,this._scrollY2Axis(g,this._y2rs),this._y2rs.move(d,e,f))};DvtHandleManager.prototype.dispatchJSEvents=function(){null!=this._o1rs&&this._o1rs.move(0,!0,!0);null!=this._x1rs&&this._x1rs.move(0,!0,!0);null!=this._y1rs&&this._y1rs.move(0,!0,!0);null!=this._y2rs&&this._y2rs.move(0,!0,!0)};
DvtHandleManager.prototype.getHandle=function(a){switch(a){case DvtGraphHandle.ID_PA:return this._hPA;case DvtGraphHandle.ID_X1L:return this._hX1L;case DvtGraphHandle.ID_Y1PA:return this._hY1PA;case DvtGraphHandle.ID_Y2PA:return this._hY2PA;case DvtGraphHandle.ID_OL:return this._hOL;case DvtGraphHandle.ID_Y1L:return this._hY1L;case DvtGraphHandle.ID_Y2L:return this._hY2L;default:return null}};