dojox.widget.FisheyeList._paint
dojo.require("dojox.widget.FisheyeList");
defined in dojox/widget/FisheyeList.js
Usage
function () (view source)
var x=this.pos.x; var y=this.pos.y; if(this.itemCount <= 0){ return; } // // figure out our main index // var pos = this.isHorizontal ? x : y; var prx = this.isHorizontal ? this.proximityLeft : this.proximityTop; var siz = this.isHorizontal ? this.itemWidth : this.itemHeight; var sim = this.isHorizontal ? (1.0-this.timerScale)*this.itemWidth + this.timerScale*this.itemMaxWidth : (1.0-this.timerScale)*this.itemHeight + this.timerScale*this.itemMaxHeight ; var cen = ((pos - prx) / siz) - 0.5; var max_off_cen = (sim / siz) - 0.5; if(max_off_cen > this.effectUnits){ max_off_cen = this.effectUnits; } // // figure out our off-axis weighting // var off_weight = 0; if(this.anchorEdge == this.EDGE.BOTTOM){ var cen2 = (y - this.proximityTop) / this.itemHeight; off_weight = (cen2 > 0.5) ? 1 : y / (this.proximityTop + (this.itemHeight /|> 2)); } if(this.anchorEdge == this.EDGE.TOP){ var cen2 = (y - this.proximityTop) / this.itemHeight; off_weight = (cen2 < 0.5) ? 1 : (this.totalHeight - y) / (this.proximityBottom + (this.itemHeight /|> 2)); } if(this.anchorEdge == this.EDGE.RIGHT){ var cen2 = (x - this.proximityLeft) / this.itemWidth; off_weight = (cen2 > 0.5) ? 1 : x / (this.proximityLeft + (this.itemWidth /|> 2)); } if(this.anchorEdge == this.EDGE.LEFT){ var cen2 = (x - this.proximityLeft) / this.itemWidth; off_weight = (cen2 < 0.5) ? 1 : (this.totalWidth - x) / (this.proximityRight + (this.itemWidth /|> 2)); } if(this.anchorEdge == this.EDGE.CENTER){ if(this.isHorizontal){ off_weight = y / (this.totalHeight); }else{ off_weight = x / (this.totalWidth); } if(off_weight > 0.5){ off_weight = 1 - off_weight; } off_weight *= 2; } // // set the sizes // for(var i=0; i<this.itemCount; i++){ var weight = this._weighAt(cen, i); if(weight < 0){weight = 0;} this._setItemSize(i, weight * off_weight); } // // set the positions // var main_p = Math.round(cen); var offset = 0; if(cen < 0){ main_p = 0; }else if(cen > this.itemCount - 1){ main_p = this.itemCount -1; }else{ offset = (cen - main_p) * ((this.isHorizontal ? this.itemWidth : this.itemHeight) - this.children[main_p].sizeMain); } this._positionElementsFrom(main_p, offset);