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
- _mapMovement static
- _offsetCoords static
- _startDragListener static
- init
Methods
_mapMovement
-
e -
map -
coords
This handles offset Changes and setting data has map been moved based on it. Also sets basic settings like preventDefault etc.
Parameters:
-
eEventThe event being dealt with
-
mapMapThe current instance of Map class
-
coordsCoordinatesCurrent 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
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:
-
mapMapThe current instance of Map class
init
-
mapObj
Required init functions for the plugin
Parameters:
-
mapObjMapThe current instance of Map class
