class SAPO.Component.PanController
Defined in Component/PanController/0.1/lib.js

Constructor Summary
init ([Object options])
Initialization function

Function Summary
Cancels the effect of preventClick
Default requestTranslation implementation. Applies dx and dy to scrollLeft and scrollTop, so if you rely on this, make sure element's css is correct so it has scrollbars.
Cleans up everything this object has done. After calling this, the object is useless
Mouse down listener for options.element. It registers event listeners to track mouse moves which handle dragging. If an ease out animation is being performed, it's cancelled.
Mouse move listener which handles the drag action
Mouse move listener which handles the drag action
Mouse click listener which overrides this click event
Called when starting a drag to prevent the browserr from dispatching a click event when the user stops dragging
stopDrag ( doEaseOut)
Terminates current the drag, cleans up and does the ease out animation

Constructor Details

constructor init

init([Object options])
Initialization function
Parameters:
[options] - request options
  • Node element - element where mousedown is detected to start the drag action. If requestTranslation is not overriden this element's content will be scrolled using scrollLeft/scrollTop.
  • Function requestTranslation - callback function used by the component to request a translation of dx by dy, as part of the dragging, and subsequent ease out animation. Use this if the default scrollLeft/scrollRight handling on element is not what you want. dx and dy are screen pixels. This function must return false if the translation failed or hit an edge. If false is returned during the ease out animation, the latter is cancelled. For all other cases, return true.
  • Number dragThreshold - mousedown and subsequent drags with a range of pixels lower than this value will not be regarded as drags handled by this component. Valid drags, equal or above the threshold, will cause requestTranslation to be called with proper values.
  • Boolean doEaseOutAnimation if true, after a drag, an ease out animation
  • Number speedEaseOutDecrease ratio by which the speed decreases around each 20ms when doing the ease out animation. Value of 0 means no animation, value near 1 means preserve lots of momentum.

Function Details

function allowClick

allowClick()
Cancels the effect of preventClick

function defaultRequestTranslation

Boolean defaultRequestTranslation()
Default requestTranslation implementation. Applies dx and dy to scrollLeft and scrollTop, so if you rely on this, make sure element's css is correct so it has scrollbars.
Returns:
true if there the element's content did scroll false otherwise (hit edges)

function destroy

destroy()
Cleans up everything this object has done. After calling this, the object is useless

function dragDownListener

dragDownListener()
Mouse down listener for options.element. It registers event listeners to track mouse moves which handle dragging. If an ease out animation is being performed, it's cancelled.

function dragMoveListener

dragMoveListener()
Mouse move listener which handles the drag action

function dragUpListener

dragUpListener()
Mouse move listener which handles the drag action

function preClickListener

preClickListener()
Mouse click listener which overrides this click event

function preventClick

preventClick()
Called when starting a drag to prevent the browserr from dispatching a click event when the user stops dragging

function stopDrag

stopDrag( doEaseOut)
Terminates current the drag, cleans up and does the ease out animation
Parameters:
doEaseOut if true, the ease out animation is done, else the map just freezes