Packagecom.yworks.canvas.input
Classpublic class MouseHoverInputMode
InheritanceMouseHoverInputMode Inheritance AbstractConcurrentInputMode Inheritance AbstractInputMode Inheritance flash.events.EventDispatcher

An IInputMode that detects when the mouse hovers over the CanvasComponent.

This implementation will show a ToolTip. In order to make use of this instance one has to provide a textProvider function to the instance. Setting a custom validHoverLocationHitTestable will restrict the area where a tooltip can be shown.

See also

textProvider


Public Properties
 PropertyDefined By
 Inheritedcanvas : CanvasComponent
[read-only] The canvas instance this mode is currently installed in or null
AbstractInputMode
 Inheritedcontroller : ConcurrencyController
Gets or injects the ConcurrencyController for this instance.
AbstractConcurrentInputMode
 Inheritedenabled : Boolean
Gets or sets the enabled state of this input mode.
AbstractConcurrentInputMode
  hideDelay : uint
The duration a tooltip is visible, in milliseconds.
MouseHoverInputMode
  hideEffect : Effect
The effect that is triggered when a tooltip is to be hidden.
MouseHoverInputMode
 InheritedinputModeContext : IInputModeContext
[read-only] The context instance this mode is currently installed in or null if this instance is not installed.
AbstractInputMode
 Inheritedinstalled : Boolean
[read-only] Whether this mode is currently installed, i.e if a call to the canvas property will yield a non-null result.
AbstractInputMode
 InheritedpreferredCursor : Cursor
Gets or sets the cursor this mode would like to have displayed in the CanvasComponent.
AbstractConcurrentInputMode
  showDelay : uint
The delay between a mouse hover over a target item and the display of a tooltip for this item.
MouseHoverInputMode
  showEffect : Effect
The effect that is triggered when a tooltip is to be shown.
MouseHoverInputMode
  showing : Boolean
Determines whether the tooltip is currently showing.
MouseHoverInputMode
  textProvider : Function
Gets or sets the provider callback that returns a tool tip text for a given location.
MouseHoverInputMode
  toolTip : DisplayObject
Gets or sets the toolTip instance to use during display.
MouseHoverInputMode
  validHoverLocationHitTestable : IHitTestable
Gets or sets an IHitTestable that determines where the mouse may hover and a Tooltip can be shown.
MouseHoverInputMode
Protected Properties
 PropertyDefined By
  _lastMouseEvent : CanvasMouseEvent
MouseHoverInputMode
Public Methods
 MethodDefined By
  
MouseHoverInputMode(toolTip:DisplayObject = null, textProvider:Function = null)
Creates a new instance using the provided ToolTip and text provider.
MouseHoverInputMode
 Inherited
cancel():void
[override] Releases the mutex if this input mode currently owns the mutex.
AbstractConcurrentInputMode
 Inherited
dispose():void
Disposes this input mode.
AbstractInputMode
  
hide():void
Immediately hides the tooltip.
MouseHoverInputMode
 Inherited
Installs this mode into the canvas of the given context.
AbstractInputMode
  
show(x:Number, y:Number):void
Immediately shows the tooltip at the given location.
MouseHoverInputMode
 Inherited
stop():Boolean
[override] Returns true if this input mode doesn't own the mutex.
AbstractConcurrentInputMode
 Inherited
Uninstalls this mode from the canvas.
AbstractInputMode
Protected Methods
 MethodDefined By
 Inherited
canRequestMutex():Boolean
Determines whether this instance can request the InputMutex.
AbstractConcurrentInputMode
  
Creates an IInputModeContext for use with the textProvider function for the upcoming text query operation.
MouseHoverInputMode
  
createToolTip():DisplayObject
Create a DisplayObject that will be shown as a tooltip.
MouseHoverInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
 Inherited
AbstractInputMode
  
getToolTipLocation(x:Number, y:Number):IPoint
Finds the position in view coordinates to display the tooltip at for the given world coordinates.
MouseHoverInputMode
  
getToolTipText(location:IPoint):String
Callback method that provides a text for the given location or null.
MouseHoverInputMode
 Inherited
hasMutex():Boolean
Determines whether this instance owns the input mutex.
AbstractConcurrentInputMode
 Inherited
initialize():void
Performs one-time initialization of this instance.
AbstractInputMode
  
initializeAndSizeTip(text:String):void
Initialize the current tooltip before it is shown.
MouseHoverInputMode
  
[override] Installs this mode into the given canvas.
MouseHoverInputMode
 Inherited
invalidate():void
Convenience method for subclass implementations that invalidates the canvasComponent this mode is currently installed in.
AbstractInputMode
  
onDisabled():void
[override] Called when the enabled property changes to false.
MouseHoverInputMode
 Inherited
onEnabled():void
Called when the enabled property changes to true.
AbstractConcurrentInputMode
  
onHide():void
Called when the tooltip should be hidden.
MouseHoverInputMode
  
onHideTimer(evt:TimerEvent):void
Called by a timer to hide the tooltip.
MouseHoverInputMode
  
Called when a mouse event occurs.
MouseHoverInputMode
 Inherited
Called when this instance obtains the InputMutex.
AbstractConcurrentInputMode
 Inherited
Called when this instance released the InputMutex.
AbstractConcurrentInputMode
 Inherited
onPreferredCursorChanged(oldValue:Cursor, newValue:Cursor):void
Called when the preferredCursor property changes.
AbstractConcurrentInputMode
  
onShow(x:Number, y:Number):void
Triggered when the mouse hovers over the given coordinates.
MouseHoverInputMode
  
onShowTimer(evt:TimerEvent):void
Called by a timer when the mouse hovers.
MouseHoverInputMode
 Inherited
Releases the mutex that is currently owned by this instance.
AbstractConcurrentInputMode
 Inherited
Requests the InputMutex from the current controller.
AbstractConcurrentInputMode
  
setTipLocation(x:Number, y:Number):void
Set the location of the current tooltip when it is shown.
MouseHoverInputMode
  
sizeTip():void
Set the size of a toolTip.
MouseHoverInputMode
  
[override] Uninstalls this mode from the given canvas.
MouseHoverInputMode
Events
 Event Summary Defined By
 InheritedDispatched after the input mode was installed.AbstractInputMode
 InheritedDispatched before the input mode will be installed.AbstractInputMode
 InheritedDispatched when the default cursor changed.AbstractConcurrentInputMode
 InheritedDispatched after the input mode was uninstalled.AbstractInputMode
 InheritedDispatched before the input mode will be uninstalled.AbstractInputMode
Public Constants
 ConstantDefined By
 InheritedINSTALLED : String = installed
[static]
AbstractInputMode
 InheritedINSTALLING : String = installing
[static]
AbstractInputMode
 InheritedPREFERRED_CURSOR_CHANGED : String = preferredCursorChanged
[static]
AbstractConcurrentInputMode
 InheritedUNINSTALLED : String = uninstalled
[static]
AbstractInputMode
 InheritedUNINSTALLING : String = uninstalling
[static]
AbstractInputMode
Property Detail
_lastMouseEventproperty
protected var _lastMouseEvent:CanvasMouseEvent

hideDelayproperty 
hideDelay:uint

The duration a tooltip is visible, in milliseconds.

The default value is 3000.

This property can be used as the source for data binding.


Implementation
    public function get hideDelay():uint
    public function set hideDelay(value:uint):void
hideEffectproperty 
hideEffect:Effect

The effect that is triggered when a tooltip is to be hidden.

The default value is null.


Implementation
    public function get hideEffect():Effect
    public function set hideEffect(value:Effect):void
showDelayproperty 
showDelay:uint

The delay between a mouse hover over a target item and the display of a tooltip for this item.

The default value is 500.

This property can be used as the source for data binding.


Implementation
    public function get showDelay():uint
    public function set showDelay(value:uint):void
showEffectproperty 
showEffect:Effect

The effect that is triggered when a tooltip is to be shown.

The default value is null.


Implementation
    public function get showEffect():Effect
    public function set showEffect(value:Effect):void
showingproperty 
showing:Boolean

Determines whether the tooltip is currently showing.


Implementation
    public function get showing():Boolean
    public function set showing(value:Boolean):void
textProviderproperty 
textProvider:Function

Gets or sets the provider callback that returns a tool tip text for a given location.

The textProvider function is a function that takes a IInputModeContext and an IPoint that specifies the tooltip location as arguments and returns a String:

		 function myTooltipTextProvider( context:IInputModeContext, location:IPoint ):String {
		 	 var s:String;
		   ..
		   return s;
		 }
		 


Implementation
    public function get textProvider():Function
    public function set textProvider(value:Function):void

See also

toolTipproperty 
toolTip:DisplayObject

Gets or sets the toolTip instance to use during display.

This method will trigger the createToolTip method if no tool tip has been set.


Implementation
    public function get toolTip():DisplayObject
    public function set toolTip(value:DisplayObject):void
validHoverLocationHitTestableproperty 
validHoverLocationHitTestable:IHitTestable

Gets or sets an IHitTestable that determines where the mouse may hover and a Tooltip can be shown. The default value of this property always returns true.


Implementation
    public function get validHoverLocationHitTestable():IHitTestable
    public function set validHoverLocationHitTestable(value:IHitTestable):void
Constructor Detail
MouseHoverInputMode()Constructor
public function MouseHoverInputMode(toolTip:DisplayObject = null, textProvider:Function = null)

Creates a new instance using the provided ToolTip and text provider.

Parameters
toolTip:DisplayObject (default = null) — The DisplayObject that will be shown as a tool tip. If null, a mx.controls.ToolTip instance is used.
 
textProvider:Function (default = null) — The text provider function

See also

Method Detail
createHoverInputModeContext()method
protected function createHoverInputModeContext():IInputModeContext

Creates an IInputModeContext for use with the textProvider function for the upcoming text query operation.

Returns
IInputModeContext — An instance of IInputModeContext.

See also

createToolTip()method 
protected function createToolTip():DisplayObject

Create a DisplayObject that will be shown as a tooltip.

If the tooltip is an IStyleClient, it will be shown and hidden using the showEffect and hideEffect properties.

If the tooltip is not an IUIComponent, initializeAndSizeTip will have to be overridden to correctly initialize the tooltip.

Returns
DisplayObject — A DisplayObject to use as a tooltip.
getToolTipLocation()method 
protected function getToolTipLocation(x:Number, y:Number):IPoint

Finds the position in view coordinates to display the tooltip at for the given world coordinates.

Parameters

x:Number — The x world coordinate.
 
y:Number — The y world coordinate.

Returns
IPoint — The position in view coordinates.
getToolTipText()method 
protected function getToolTipText(location:IPoint):String

Callback method that provides a text for the given location or null.

Parameters

location:IPoint — The location to find a text for.

Returns
String — A string or null to indicate that no ToolTip should be shown.

See also

hide()method 
public function hide():void

Immediately hides the tooltip.

initializeAndSizeTip()method 
protected function initializeAndSizeTip(text:String):void

Initialize the current tooltip before it is shown.

Parameters

text:String

installCore()method 
override protected function installCore(context:IInputModeContext):void

Installs this mode into the given canvas.

Installation usually means registering some event listeners on the canvasComponent or on canvasComponent.root.

Parameters

context:IInputModeContext — The context containing the graph canvas that this instance shall be installed into

onDisabled()method 
override protected function onDisabled():void

Called when the enabled property changes to false.

This implementation sets the preferredCursor property to null.

onHide()method 
protected function onHide():void

Called when the tooltip should be hidden.

onHideTimer()method 
protected function onHideTimer(evt:TimerEvent):void

Called by a timer to hide the tooltip.

Parameters

evt:TimerEvent — The timer event.

onMouseEvent()method 
protected function onMouseEvent(evt:CanvasMouseEvent):void

Called when a mouse event occurs.

Parameters

evt:CanvasMouseEvent — The mouse event to handle.

onShow()method 
protected function onShow(x:Number, y:Number):void

Triggered when the mouse hovers over the given coordinates.

This method will call getToolTipText to query the text and will display the toolTip at the location returned by getToolTipLocation if the text is not null.

Parameters

x:Number — The x coordinate in world coordinates
 
y:Number — The y coordinate in world coordinates

onShowTimer()method 
protected function onShowTimer(evt:TimerEvent):void

Called by a timer when the mouse hovers.

Parameters

evt:TimerEvent — The timer event.

setTipLocation()method 
protected function setTipLocation(x:Number, y:Number):void

Set the location of the current tooltip when it is shown.

Parameters

x:Number — The x-coordinate of the tooltip location in stage coordinates.
 
y:Number — The y-coordinate of the tooltip location in stage coordinates.

show()method 
public function show(x:Number, y:Number):void

Immediately shows the tooltip at the given location.

Parameters

x:Number — The x location in the world coordinate system.
 
y:Number — The y location in the world coordinate system.

sizeTip()method 
protected function sizeTip():void

Set the size of a toolTip.

It is assumed that toolTip is an IUIComponent. If not, override this method.


Throws
ArgumentError — if toolTip is not an IUIComponent.
uninstallCore()method 
override protected function uninstallCore(context:IInputModeContext):void

Uninstalls this mode from the given canvas. This code should clean up all changes made to the canvas in the install method. After a mode has been uninstalled it can be installed again into the same or another canvas.

Parameters

context:IInputModeContext — The context containing the graph canvas that this instance shall be deregistered from.

See also