Spark Slider - Functional and Design SpecificationSpark Slider - Functional and Design Specification | Glossary | Summary and Background | Usage Scenarios | Detailed Description | API Description | B Features | Additional Implementation Details | Prototype Work | Compiler Work | Web Tier Compiler Impact | Flex Feature Dependencies | Backwards Compatibility | Accessibility | Performance | Globalization | Localization | QA
Glossaryposition - The position of the thumb is defined in the units of the subclasses of TrackBase (ie: pixels, radians, etc...). It is converted back and forth from the actual value of TrackBase. logical track, logical thumb - The logical track is the range of positions determined in the units of the subclass. The logical thumb can move through the entire range of positions from end to end. visual track, visual thumb - The visual track and visual thumb are the actual track and thumb that is rendered. They may need to be offset from the logical track and thumb to provide the correct look. Example:HSlider position = x value in pixels Example:CircularSlider position = radians which is then converted in positionThumb() to a point based on the width/height of the track SkinPart. These concepts of logical and visual track separate the layout of the track from the functional part of the track. Summary and BackgroundThe Slider class is the base class for FxSlider controls. It inherits from TrackBase, which contains code common to both Sliders and ScrollBars. Slider provides basic functionality for Slider controls such as liveDragging, keyboard handling and track click handling. Usage Scenarios
Detailed DescriptionSkinPartsSlider consists of 2 SkinParts inherited from TrackBase Inherited PropertiesNew Properties
EventsWhenever the value changes, a "valueCommit" event is dispatched (from Range). Track BehaviorClicking on the track should result in the thumb sliding to that position. Currently, the track click causes the thumb to just appear at that point. In the future, the "slide" will be implemented along with functions that will allow it to be customizable (providing parameters to an easing function, etc...). Keyboard BehaviorWhen the thumb has focus:
A future consideration is how to easily change the keyboard behavior in subclasses instead of assuming standard behavior based on the values. Consider the case of a reversed HSlider where the max is on the left instead of the right. Additional Items to be considered
API Descriptionpackage spark.components.supportClasses { import flash.events.Event; import flash.events.KeyboardEvent; import flash.events.MouseEvent; import flash.geom.Point; import flash.ui.Keyboard; import mx.managers.IFocusManagerComponent; /** * Slider */ public class Slider extends TrackBase implements IFocusManagerComponent { include "../core/Version.as"; //-------------------------------------------------------------------------- // // Constructor // //-------------------------------------------------------------------------- /** * Constructor. */ public function Slider():void; //-------------------------------------------------------------------------- // // Properties // //-------------------------------------------------------------------------- //--------------------------------- // liveDragging //--------------------------------- /** * When liveDragging is enabled, the thumb's value is * committed as it is dragged along the track instead * of when the thumb is released. * * @default false */ public function get liveDragging():Boolean; public function set liveDragging(value:Boolean):void; //-------------------------------------------------------------------------- // // Methods // //-------------------------------------------------------------------------- /** * @private */ override public function setFocus():void; /** * @private */ override protected function partAdded(partName:String, instance:*):void; /** * Converts a point retrieved from clicking on the track * into a position. This allows subclasses to center * their thumb when clicking on the track. */ protected function pointClickToPosition(localX:Number, localY:Number):Number; //-------------------------------------------------------------------------- // // Event Handlers // //-------------------------------------------------------------------------- //--------------------------------- // Thumb dragging handlers //--------------------------------- /** * @private */ override protected function thumb_mouseDownHandler(event:MouseEvent):void; /** * @private */ override protected function system_mouseMoveHandler(event:MouseEvent):void; /** * @private */ override protected function system_mouseUpHandler(event:MouseEvent):void; //--------------------------------- // Thumb keyboard handlers //--------------------------------- /** * Handle keyboard events. Left/Down decreases the value * decreases the value by stepSize. The opposite for * Right/Up arrows. The Home and End keys set the value * to the min and max respectively. */ protected function thumb_keyboardHandler(event:KeyboardEvent):void; //--------------------------------- // Track down handlers //--------------------------------- /** * Handle mouse-down events for the slider track. We * calculate the value based on the new position and then * move the thumb to the correct location as well as * commit the value. */ override protected function track_mouseDownHandler(event:MouseEvent):void; } } B FeaturesAdditional Implementation Detailsnone Prototype Work
Compiler Worknone Web Tier Compiler Impactnone Flex Feature Dependencies
Backwards CompatibilitySyntax changesNone - New Class BehaviorNone Warnings/DeprecationNone AccessibilitySupport Halo equivalent. Performancenone. Globalizationnone LocalizationCompiler Featuresnone. QAYes. |
|
| You must be logged in to comment. |
|---|
