ScaleBase.js 2.43 KB
//>>built
define("dojo/_base/lang dojo/_base/declare dojox/gfx dojo/_base/array dojox/widget/_Invalidating dojo/_base/sniff".split(" "),function(d,f,g,e,h,k){return f("dojox.dgauges.ScaleBase",h,{scaler:null,font:null,labelPosition:null,labelGap:1,tickStroke:null,_gauge:null,_gfxGroup:null,_bgGroup:null,_fgGroup:null,_indicators:null,_indicatorsIndex:null,_indicatorsRenderers:null,constructor:function(){this._indicators=[];this._indicatorsIndex={};this._indicatorsRenderers={};this._gfxGroup=this._gauge=null;
this.tickStroke={color:"black",width:8>=k("ie")?1:.5};this.addInvalidatingProperties("scaler font labelGap labelPosition tickShapeFunc tickLabelFunc tickStroke".split(" "));this.watch("scaler",d.hitch(this,this._watchScaler))},postscript:function(a){this.inherited(arguments);a&&a.scaler&&this._watchScaler("scaler",null,a.scaler)},_watchers:null,_watchScaler:function(a,b,c){e.forEach(this._watchers,d.hitch(this,function(a){a.unwatch()}));a=c.watchedProperties;this._watchers=[];e.forEach(a,d.hitch(this,
function(a){this._watchers.push(c.watch(a,d.hitch(this,this.invalidateRendering)))}))},_getFont:function(){var a=this.font;a||(a=this._gauge.font);a||(a=g.defaultFont);return a},positionForValue:function(a){return 0},valueForPosition:function(a){},tickLabelFunc:function(a){return a.isMinor?null:String(a.value)},tickShapeFunc:function(a,b,c){return a.createLine({x1:0,y1:0,x2:c.isMinor?6:10,y2:0}).setStroke(this.tickStroke)},getIndicatorRenderer:function(a){return this._indicatorsRenderers[a]},removeIndicator:function(a){var b=
this._indicatorsIndex[a];if(b){b._gfxGroup.removeShape();var c=this._indicators.indexOf(b);this._indicators.splice(c,1);b._disconnectListeners();delete this._indicatorsIndex[a];delete this._indicatorsRenderers[a]}this._gauge&&this._gauge._resetMainIndicator();this.invalidateRendering();return b},getIndicator:function(a){return this._indicatorsIndex[a]},addIndicator:function(a,b,c){this._indicatorsIndex[a]&&this._indicatorsIndex[a]!=b&&this.removeIndicator(a);this._indicators.push(b);this._indicatorsIndex[a]=
b;this._ticksGroup||this._createSubGroups();b._gfxGroup=(c?this._bgGroup:this._fgGroup).createGroup();b.scale=this;return this.invalidateRendering()},_createSubGroups:function(){this._gfxGroup&&!this._ticksGroup&&(this._bgGroup=this._gfxGroup.createGroup(),this._ticksGroup=this._gfxGroup.createGroup(),this._fgGroup=this._gfxGroup.createGroup())},refreshRendering:function(){this._ticksGroup||this._createSubGroups()}})});