API Docs for: 0.1.1
Show:

flatworld.extensions.mapDrag Class

Core plugin for the engine. Handles moving the map by dragging the map with mouse or touch event. Core plugins can always be overwrote if needed.

Item Index

Methods

Methods

_mapMovement

(
  • e
  • map
  • coords
)
private static

This handles offset Changes and setting data has map been moved based on it. Also sets basic settings like preventDefault etc.

Parameters:

  • e Event

    The event being dealt with

  • map Map

    The current instance of Map class

  • coords Coordinates

    Current pointer coordinates

_offsetCoords

() private static

Function for setting and getting the mouse offset. Offset is the distance from the left upper coordinates (global 0, 0 coordinates) on the canvas, to the current / last known mouse coordinates

_startDragListener

(
  • map
)
private static

Mobile version. Starts the functionality, uses Hammer.js heavily for doing the drag. More simple and better than desktop version, since we don't need to calculate the drag with several event listener, one is enough with Hammer

Parameters:

  • map Map

    The current instance of Map class

init

(
  • mapObj
)

Required init functions for the plugin

Parameters:

  • mapObj Map

    The current instance of Map class