docs: function _handleLayerDrag($canvas, data, eventType) {
  	var layers, layer, l,
  		drag, dragGroups,
  		group, groupName, g,
  		newX, newY;
  
  	drag = data.drag;
  	layer = drag.layer;
  	dragGroups = (layer && layer.dragGroups) || [];
  	layers = data.layers;
  
  	if (eventType === 'mousemove' || eventType === 'touchmove') {
  		// Detect when user is currently dragging layer
  
  		if (!drag.dragging) {
  			// Detect when user starts dragging layer
  
  			// Signify that a layer on the canvas is being dragged
  			drag.dragging = true;
  			layer.dragging = true;
  
  			// Optionally bring layer to front when drag starts
  			if (layer.bringToFront) {
  				// Remove layer from its original position
  				layers.splice(layer.index, 1);
  				// Bring layer to front
  				// push() returns the new array length
  				layer.index = layers.push(layer);
  			}
  
  			// Set drag properties for this layer
  			layer._startX = layer.x;
  			layer._startY = layer.y;
  			layer._endX = layer._eventX;
  			layer._endY = layer._eventY;
  
  			// Trigger dragstart event
  			_triggerLayerEvent($canvas, data, layer, 'dragstart');
  
  		}
  
  		if (drag.dragging) {
  
  			// Calculate position after drag
  			newX = layer._eventX - (layer._endX - layer._startX);
  			newY = layer._eventY - (layer._endY - layer._startY);
  			if (layer.updateDragX) {
  				newX = layer.updateDragX.call($canvas[0], layer, newX);
  			}
  			if (layer.updateDragY) {
  				newY = layer.updateDragY.call($canvas[0], layer, newY);
  			}
  			layer.dx = newX - layer.x;
  			layer.dy = newY - layer.y;
  			if (layer.restrictDragToAxis !== 'y') {
  				layer.x = newX;
  			}
  			if (layer.restrictDragToAxis !== 'x') {
  				layer.y = newY;
  			}
  
  			// Trigger drag event
  			_triggerLayerEvent($canvas, data, layer, 'drag');
  
  			// Move groups with layer on drag
  			for (g = 0; g < dragGroups.length; g += 1) {
  
  				groupName = dragGroups[g];
  				group = data.layer.groups[groupName];
  				if (layer.groups && group) {
  
  					for (l = 0; l < group.length; l += 1) {
  						if (group[l] !== layer) {
  							if (layer.restrictDragToAxis !== 'y' && group[l].restrictDragToAxis !== 'y') {
  								group[l].x += layer.dx;
  							}
  							if (layer.restrictDragToAxis !== 'x' && group[l].restrictDragToAxis !== 'x') {
  								group[l].y += layer.dy;
  							}
  						}
  					}
  
  				}
  
  			}
  
  		}
  
  	} else if (eventType === 'mouseup' || eventType === 'touchend') {
  		// Detect when user stops dragging layer
  
  		if (drag.dragging) {
  			layer.dragging = false;
  			drag.dragging = false;
  			data.redrawOnMousemove = data.originalRedrawOnMousemove;
  			// Trigger dragstop event
  			_triggerLayerEvent($canvas, data, layer, 'dragstop');
  		}
  
  		// Cancel dragging
  		data.drag = {};
  
  	}
  }