dist/jcanvas.js
function _getIntersectingLayer(data) {
	var layer, i,
		mask, m;

	// Store the topmost layer
	layer = null;

	// Get the topmost layer whose visible area intersects event coordinates
	for (i = data.intersecting.length - 1; i >= 0; i -= 1) {

		// Get current layer
		layer = data.intersecting[i];

		// If layer has previous masks
		if (layer._masks) {

			// Search previous masks to ensure
			// layer is visible at event coordinates
			for (m = layer._masks.length - 1; m >= 0; m -= 1) {
				mask = layer._masks[m];
				// If mask does not intersect event coordinates
				if (!mask.intersects) {
					// Indicate that the mask does not
					// intersect event coordinates
					layer.intersects = false;
					// Stop searching previous masks
					break;
				}

			}

			// If event coordinates intersect all previous masks
			// and layer is not intangible
			if (layer.intersects && !layer.intangible) {
				// Stop searching for topmost layer
				break;
			}

		}

	}
	// If resulting layer is intangible
	if (layer && layer.intangible) {
		// Cursor does not intersect this layer
		layer = null;
	}
	return layer;
}
function _getIntersectingLayer(data) {
	var layer, i,
		mask, m;

	// Store the topmost layer
	layer = null;

	// Get the topmost layer whose visible area intersects event coordinates
	for (i = data.intersecting.length - 1; i >= 0; i -= 1) {

		// Get current layer
		layer = data.intersecting[i];

		// If layer has previous masks
		if (layer._masks) {

			// Search previous masks to ensure
			// layer is visible at event coordinates
			for (m = layer._masks.length - 1; m >= 0; m -= 1) {
				mask = layer._masks[m];
				// If mask does not intersect event coordinates
				if (!mask.intersects) {
					// Indicate that the mask does not
					// intersect event coordinates
					layer.intersects = false;
					// Stop searching previous masks
					break;
				}

			}

			// If event coordinates intersect all previous masks
			// and layer is not intangible
			if (layer.intersects && !layer.intangible) {
				// Stop searching for topmost layer
				break;
			}

		}

	}
	// If resulting layer is intangible
	if (layer && layer.intangible) {
		// Cursor does not intersect this layer
		layer = null;
	}
	return layer;
}
function _getIntersectingLayer ( data ) { var layer , i , mask , m ; // Store the topmost layer layer = null ; // Get the topmost layer whose visible area intersects event coordinates for ( i = data . intersecting . length - 1 ; i >= 0 ; i -= 1 ) { // Get current layer layer = data . intersecting [ i ] ; // If layer has previous masks if ( layer . _masks ) { // Search previous masks to ensure // layer is visible at event coordinates for ( m = layer . _masks . length - 1 ; m >= 0 ; m -= 1 ) { mask = layer . _masks [ m ] ; // If mask does not intersect event coordinates if ( ! mask . intersects ) { // Indicate that the mask does not // intersect event coordinates layer . intersects = false ; // Stop searching previous masks break ; } } // If event coordinates intersect all previous masks // and layer is not intangible if ( layer . intersects && ! layer . intangible ) { // Stop searching for topmost layer break ; } } } // If resulting layer is intangible if ( layer && layer . intangible ) { // Cursor does not intersect this layer layer = null ; } return layer ; }
Get topmost layer that intersects with event coordinates
Get topmost layer that intersects with event coordinates