Packagefeathers.utils.touch
Classpublic class TapToSelect
InheritanceTapToSelect Inheritance Object

Product Version : Feathers 2.3.0

Changes the isSelected property of the target when the target is tapped (which will dispatch Event.CHANGE). Conveniently handles all TouchEvent listeners automatically. Useful for custom item renderers that should be selected when tapped.

In the following example, a custom item renderer will be selected when tapped:

public class CustomItemRenderer extends LayoutGroupListItemRenderer
{
    public function CustomItemRenderer()
    {
        super();
        this._tapToSelect = new TapToSelect(this);
    }
    
    private var _tapToSelect:TapToSelect;
}

Note: When combined with a TapToTrigger instance, the TapToSelect instance should be created second because Event.TRIGGERED should be dispatched before Event.CHANGE.

See also

feathers.utils.touch.TapToTrigger
feathers.utils.touch.LongPress


Public Properties
 PropertyDefined By
  customHitTest : Function
In addition to a normal call to hitTest(), a custom function may impose additional rules that determine if the target should be selected.
TapToSelect
  isEnabled : Boolean
May be set to false to disable selection temporarily until set back to true.
TapToSelect
  tapToDeselect : Boolean
May be set to true to allow the target to be deselected when tapped.
TapToSelect
  target : IToggle
The target component that should be selected when tapped.
TapToSelect
Public Methods
 MethodDefined By
  
TapToSelect(target:IToggle = null)
Constructor.
TapToSelect
Property Detail
customHitTestproperty
customHitTest:Function

In addition to a normal call to hitTest(), a custom function may impose additional rules that determine if the target should be selected. Called on TouchPhase.BEGAN.

The function must have the following signature:

function(localPosition:Point):Boolean;

The function should return true if the target should be selected, and false if it should not be selected.


Implementation
    public function get customHitTest():Function
    public function set customHitTest(value:Function):void
isEnabledproperty 
isEnabled:Boolean

May be set to false to disable selection temporarily until set back to true.


Implementation
    public function get isEnabled():Boolean
    public function set isEnabled(value:Boolean):void
tapToDeselectproperty 
tapToDeselect:Boolean

May be set to true to allow the target to be deselected when tapped.


Implementation
    public function get tapToDeselect():Boolean
    public function set tapToDeselect(value:Boolean):void
targetproperty 
target:IToggle

The target component that should be selected when tapped.


Implementation
    public function get target():IToggle
    public function set target(value:IToggle):void
Constructor Detail
TapToSelect()Constructor
public function TapToSelect(target:IToggle = null)

Constructor.

Parameters
target:IToggle (default = null)