dist/jcanvas.js
function _detectEvents(canvas, ctx, params) {
	var layer, data, eventCache, intersects,
		transforms, x, y, angle;

	// Use the layer object stored by the given parameters object
	layer = params._args;
	// Canvas must have event bindings
	if (layer) {

		data = _getCanvasData(canvas);
		eventCache = data.event;
		if (eventCache.x !== null && eventCache.y !== null) {
			// Respect user-defined pixel ratio
			x = eventCache.x * data.pixelRatio;
			y = eventCache.y * data.pixelRatio;
			// Determine if the given coordinates are in the current path
			intersects = ctx.isPointInPath(x, y) || (ctx.isPointInStroke && ctx.isPointInStroke(x, y));
		}
		transforms = data.transforms;

		// Allow callback functions to retrieve the mouse coordinates
		layer.eventX = eventCache.x;
		layer.eventY = eventCache.y;
		layer.event = eventCache.event;

		// Adjust coordinates to match current canvas transformation

		// Keep track of some transformation values
		angle = data.transforms.rotate;
		x = layer.eventX;
		y = layer.eventY;

		if (angle !== 0) {
			// Rotate coordinates if coordinate space has been rotated
			layer._eventX = (x * cos(-angle)) - (y * sin(-angle));
			layer._eventY = (y * cos(-angle)) + (x * sin(-angle));
		} else {
			// Otherwise, no calculations need to be made
			layer._eventX = x;
			layer._eventY = y;
		}

		// Scale coordinates
		layer._eventX /= transforms.scaleX;
		layer._eventY /= transforms.scaleY;

		// If layer intersects with cursor
		if (intersects) {
			// Add it to a list of layers that intersect with cursor
			data.intersecting.push(layer);
		}
		layer.intersects = Boolean(intersects);
	}
}
function _detectEvents(canvas, ctx, params) {
	var layer, data, eventCache, intersects,
		transforms, x, y, angle;

	// Use the layer object stored by the given parameters object
	layer = params._args;
	// Canvas must have event bindings
	if (layer) {

		data = _getCanvasData(canvas);
		eventCache = data.event;
		if (eventCache.x !== null && eventCache.y !== null) {
			// Respect user-defined pixel ratio
			x = eventCache.x * data.pixelRatio;
			y = eventCache.y * data.pixelRatio;
			// Determine if the given coordinates are in the current path
			intersects = ctx.isPointInPath(x, y) || (ctx.isPointInStroke && ctx.isPointInStroke(x, y));
		}
		transforms = data.transforms;

		// Allow callback functions to retrieve the mouse coordinates
		layer.eventX = eventCache.x;
		layer.eventY = eventCache.y;
		layer.event = eventCache.event;

		// Adjust coordinates to match current canvas transformation

		// Keep track of some transformation values
		angle = data.transforms.rotate;
		x = layer.eventX;
		y = layer.eventY;

		if (angle !== 0) {
			// Rotate coordinates if coordinate space has been rotated
			layer._eventX = (x * cos(-angle)) - (y * sin(-angle));
			layer._eventY = (y * cos(-angle)) + (x * sin(-angle));
		} else {
			// Otherwise, no calculations need to be made
			layer._eventX = x;
			layer._eventY = y;
		}

		// Scale coordinates
		layer._eventX /= transforms.scaleX;
		layer._eventY /= transforms.scaleY;

		// If layer intersects with cursor
		if (intersects) {
			// Add it to a list of layers that intersect with cursor
			data.intersecting.push(layer);
		}
		layer.intersects = Boolean(intersects);
	}
}
function _detectEvents ( canvas , ctx , params ) { var layer , data , eventCache , intersects , transforms , x , y , angle ; // Use the layer object stored by the given parameters object layer = params . _args ; // Canvas must have event bindings if ( layer ) { data = _getCanvasData ( canvas ) ; eventCache = data . event ; if ( eventCache . x !== null && eventCache . y !== null ) { // Respect user-defined pixel ratio x = eventCache . x * data . pixelRatio ; y = eventCache . y * data . pixelRatio ; // Determine if the given coordinates are in the current path intersects = ctx . isPointInPath ( x , y ) || ( ctx . isPointInStroke && ctx . isPointInStroke ( x , y ) ) ; } transforms = data . transforms ; // Allow callback functions to retrieve the mouse coordinates layer . eventX = eventCache . x ; layer . eventY = eventCache . y ; layer . event = eventCache . event ; // Adjust coordinates to match current canvas transformation // Keep track of some transformation values angle = data . transforms . rotate ; x = layer . eventX ; y = layer . eventY ; if ( angle !== 0 ) { // Rotate coordinates if coordinate space has been rotated layer . _eventX = ( x * cos ( - angle ) ) - ( y * sin ( - angle ) ) ; layer . _eventY = ( y * cos ( - angle ) ) + ( x * sin ( - angle ) ) ; } else { // Otherwise, no calculations need to be made layer . _eventX = x ; layer . _eventY = y ; } // Scale coordinates layer . _eventX /= transforms . scaleX ; layer . _eventY /= transforms . scaleY ; // If layer intersects with cursor if ( intersects ) { // Add it to a list of layers that intersect with cursor data . intersecting . push ( layer ) ; } layer . intersects = Boolean ( intersects ) ; } }
Check if event fires when a drawing is drawn
Check if event fires when a drawing is drawn