package qs.controls { import qs.controls.fisheyeClasses.actionscript_extra_fisheye_qs_controls_FisheyeBase; import qs.controls.fisheyeClasses.actionscript_extra_fisheye_qs_controls_FisheyeItem; import qs.controls.fisheyeClasses.actionscript_extra_fisheye_qs_controls_FisheyeAxis; public class actionscript_extra_fisheye_qs_controls_Fisheye extends actionscript_extra_fisheye_qs_controls_FisheyeBase { /** the ideal positional data for the renderers. When the inputs to the layout system change, * this array is regenerated to represent the goal positions for each renderer. Over time, the layout system * will animate the children towards these positions */ private var _pdata:Array = []; private var _mouseData:Array = []; /** the direction this component lays out */ private var _direction:String = "horizontal"; /* abstractions around x/y, width/height. Instead of asking for x/y based properties directly, * we go through these properties. Switch the properties, and our layout switches axis. Presto! */ protected var major:actionscript_extra_fisheye_qs_controls_FisheyeAxis = new actionscript_extra_fisheye_qs_controls_FisheyeAxis(); protected var minor:actionscript_extra_fisheye_qs_controls_FisheyeAxis = new actionscript_extra_fisheye_qs_controls_FisheyeAxis(); //----------------------------------------------------------------- public function actionscript_extra_fisheye_qs_controls_Fisheye() { major.direction = "horizontal"; minor.direction = "vertical"; } /** whether we layout along the horizontal or vertical axis */ public function set direction(value:String):void { if(value == _direction) return; _direction = value; if(_direction == "vertical") { major.direction = "vertical"; minor.direction = "horizontal"; } else { major.direction = "horizontal"; minor.direction = "vertical"; } invalidateSize(); animator.invalidateLayout(); } public function get direction():String { return _direction; } override protected function measure():void { var minorMeasuredSize:Number = 0; var count:Number = dataProvider.length; for (var i:int = 0;i this[major.unscaled]) targetPosition = this[major.unscaled] - pdata[major.EOM]*maxScaleWithDefault; populateMajorAxisFor(_pdata.slice(targetIndex),0,this[major.unscaled] - targetPosition,major); for (var i:int = targetIndex;i 0) { populateMajorAxisFor(_pdata.slice(0,targetIndex),targetIndex,targetPosition - defaultSpacingWithDefault,major); pdata = _pdata[targetIndex - 1]; var offset:Number = targetPosition - (pdata[major.pos] + pdata[major.EOM] * pdata.scale + defaultSpacingWithDefault); for(var i:int = 0;i this[minor.measured]) return NaN; break; case "left": case "top": if(minorPos > this[minor.measured]) return NaN; break; case "center": case "justified": default: if(Math.abs(this[minor.unscaled]/2 - minorPos) > this[minor.measured]/2) return NaN; break; } for(var i:int = 0; i < dataProvider.length; i++) { var dist:Number = majorPos - midPointFor(i); if (Math.abs(dist) < Math.abs(minDist)) { minDist = dist; result = i; } else { // break; } } return result; } } }