//>>built
define("dojox/dgauges/ScaleIndicatorBase","dojo/_base/lang,dojo/_base/declare,dojo/_base/window,dojo/on,dojo/_base/connect,dojo/_base/fx,dojox/gfx,dojox/widget/_Invalidating,./IndicatorBase".split(","),function(c,h,e,i,d,f,k,l,j){return h("dojox.dgauges.ScaleIndicatorBase",j,{scale:null,value:0,interactionArea:"gauge",interactionMode:"mouse",animationDuration:0,animationEaser:null,_indicatorShapeFuncFlag:!0,_interactionAreaFlag:!0,_downListeners:null,_cursorListeners:null,_moveAndUpListeners:null,
_transitionValue:NaN,_preventAnimation:!1,_animation:null,constructor:function(){this.watch("value",c.hitch(this,function(){this.valueChanged(this)}));this.watch("value",c.hitch(this,this._startAnimation));this.watch("interactionArea",c.hitch(this,function(){this._interactionAreaFlag=!0}));this.watch("interactionMode",c.hitch(this,function(){this._interactionAreaFlag=!0}));this.watch("indicatorShapeFunc",c.hitch(this,function(){this._indicatorShapeFuncFlag=!0}));this.addInvalidatingProperties(["scale",
"value","indicatorShapeFunc","interactionArea","interactionMode"]);this._downListeners=[];this._moveAndUpListeners=[];this._cursorListeners=[]},_startAnimation:function(a,b,g){if(0!=this.animationDuration)this._animation&&(this._preventAnimation||b==g)?this._animation.stop():(this._animation=new f.Animation({curve:[b,g],duration:this.animationDuration,easing:this.animationEaser?this.animationEaser:f._defaultEasing,onAnimate:c.hitch(this,this._updateAnimation),onEnd:c.hitch(this,this._endAnimation),
onStop:c.hitch(this,this._endAnimation)}),this._animation.play())},_updateAnimation:function(a){this._transitionValue=a;this.invalidateRendering()},_endAnimation:function(){this._transitionValue=NaN;this.invalidateRendering()},refreshRendering:function(){if(!(null==this._gfxGroup||null==this.scale)){if(this._indicatorShapeFuncFlag&&c.isFunction(this.indicatorShapeFunc))this._gfxGroup.clear(),this.indicatorShapeFunc(this._gfxGroup,this),this._indicatorShapeFuncFlag=!1;if(this._interactionAreaFlag)this._interactionAreaFlag=
this._connectDownListeners()}},valueChanged:function(){i.emit(this,"valueChanged",{target:this,bubbles:!0,cancelable:!0})},_disconnectDownListeners:function(){for(var a=0;a<this._downListeners.length;a++)d.disconnect(this._downListeners[a]);this._downListeners=[]},_disconnectMoveAndUpListeners:function(){for(var a=0;a<this._moveAndUpListeners.length;a++)d.disconnect(this._moveAndUpListeners[a]);this._moveAndUpListeners=[]},_disconnectListeners:function(){this._disconnectDownListeners();this._disconnectMoveAndUpListeners();
this._disconnectCursorListeners()},_connectCursorListeners:function(a){var b=a.connect("onmouseover",this,function(){this.scale._gauge._setCursor("pointer")});this._cursorListeners.push(b);b=a.connect("onmouseout",this,function(){this.scale._gauge._setCursor("")});this._cursorListeners.push(b)},_disconnectCursorListeners:function(){for(var a=0;a<this._cursorListeners.length;a++)d.disconnect(this._cursorListeners[a]);this._cursorListeners=[]},_connectDownListeners:function(){this._disconnectDownListeners();
this._disconnectCursorListeners();var a=null,b;"mouse"==this.interactionMode?b="onmousedown":"touch"==this.interactionMode&&(b="ontouchstart");if("mouse"==this.interactionMode||"touch"==this.interactionMode)if("indicator"==this.interactionArea)a=this._gfxGroup.connect(b,this,this._onMouseDown),this._downListeners.push(a),"mouse"==this.interactionMode&&this._connectCursorListeners(this._gfxGroup);else if("gauge"==this.interactionArea){if(!this.scale||!this.scale._gauge||!this.scale._gauge._gfxGroup)return!0;
a=this.scale._gauge._gfxGroup.connect(b,this,this._onMouseDown);this._downListeners.push(a);a=this._gfxGroup.connect(b,this,this._onMouseDown);this._downListeners.push(a);"mouse"==this.interactionMode&&this._connectCursorListeners(this.scale._gauge._gfxGroup)}else if("area"==this.interactionArea){if(!this.scale||!this.scale._gauge||!this.scale._gauge._baseGroup)return!0;a=this.scale._gauge._baseGroup.connect(b,this,this._onMouseDown);this._downListeners.push(a);a=this._gfxGroup.connect(b,this,this._onMouseDown);
this._downListeners.push(a);"mouse"==this.interactionMode&&this._connectCursorListeners(this.scale._gauge._baseGroup)}return!1},_connectMoveAndUpListeners:function(){var a=null,b,c;"mouse"==this.interactionMode?(b="onmousemove",c="onmouseup"):"touch"==this.interactionMode&&(b="ontouchmove",c="ontouchend");a=d.connect(e.doc,b,this,this._onMouseMove);this._moveAndUpListeners.push(a);a=d.connect(e.doc,c,this,this._onMouseUp);this._moveAndUpListeners.push(a)},_onMouseDown:function(){this._connectMoveAndUpListeners();
this._startEditing()},_onMouseMove:function(){this._preventAnimation=!0;this._animation&&this._animation.stop()},_onMouseUp:function(){this._disconnectMoveAndUpListeners();this._preventAnimation=!1;this._endEditing()},_startEditing:function(){if(this.scale&&this.scale._gauge)this.scale._gauge.onStartEditing({indicator:this})},_endEditing:function(){if(this.scale&&this.scale._gauge)this.scale._gauge.onEndEditing({indicator:this})}})});