API Docs for: 7.2
Show:

MQA.RibbonOverlay Class

Module: MQA

Special sub-class of LineOverlay which adds custom support for managing route ribbons. Ribbons exist in one of three states:

  • 'none' The ribbon is displayed with no addornments
  • 'hover' The ribbon is displayed with a drag dot projected onto it (this happens when the mouse enters the area of the ribbon)
  • 'drag' The drag dot is being dragged and may be at any physical point on the map. This happens when the mouse is depressed on the drag dot and it is moved. The state will maintain the projection information about where the drag originated from.
When in the 'hover' or 'drag' state, the following fields are populated:

  • anchorLatLng: The lat/lng of the point projected onto the ribbon where the dot was hovering or where dragging started from
  • anchorXY: The display coordinates of the anchor
  • anchorShapeIndex: The index of the lowest numbered shape point starting the segment where the anchor is.
  • anchorDistance: The ratio of the distance along the shape segment (0...1).
When in the 'drag' state, the following properties are set:

  • dragLatLng: The lat/lng of the current location of the drag dot
  • dragXY: The display coordinates of the drag dot
  • dragCount: An integer representing how many times the dragLatLng has been updated since entering the 'drag' state. Used to quickly check that the point hasn't moved since an operation started.
The ribbon fires several events by calling methods on its instance:

  • onState(ribbon, state) - Called when the state change. This is a good spot to update visual characteristics of the drag dot.
  • onDragStart(ribbon) - Called when the gesture to initiate dragging occurs
  • onDrag(ribbon) - Called on the first movement of the drag dot after entering the drag state
  • onDrop(ribbon) - Called when the drag dot is released. When this method is called, the ribbon will still be in the 'drag' state but will transition to 'none' just following
  • .
  • onDragCancel(ribbon) - Called if the drag is cancelled for some reason.
Upon creating this overlay, it should be added to a shape collection. In addition, the dragPoi property should be added to a shape collection. If it is not, then no drag behavior will be supported. The dragPoi is a BasePoi and can be customized at will.

Constructor

MQA.RibbonOverlay

()

Properties

_hoverCount

Integer private

_hoverState will be >0 if the mouse is hovering over the ribbon or the drag dot

state

String

State

Default: 'none'

Methods

onmousedown

(
  • mqe
)

Handle mouse down events

Parameters:

onmousemove

(
  • mqe
)

Handle mouse move events

Parameters:

onmouseout

(
  • mqe
)

Handle mouse out event

Parameters:

onmouseover

(
  • mqe
)

handle mouse overs

Parameters:

projectDragPoi

(
  • latLng
)
Boolean

Project drag poi

Parameters:

Returns <Boolean>

true if projected, false if not

showDragPoi

(
  • latLng
)

show drag poi

Parameters: