dist/jcanvas.js
function _updateLayerGroups($canvas, data, layer, props) {
	var groupMap = data.layer.groups,
		group, groupName, g,
		index, l;

	// If group name is not changing
	if (!props) {

		props = layer;

	} else {

		// Remove layer from all of its associated groups
		if (props.groups !== undefined && layer.groups !== null) {
			for (g = 0; g < layer.groups.length; g += 1) {
				groupName = layer.groups[g];
				group = groupMap[groupName];
				if (group) {
					// Remove layer from its old layer group entry
					for (l = 0; l < group.length; l += 1) {
						if (group[l] === layer) {
							// Keep track of the layer's initial index
							index = l;
							// Remove layer once found
							group.splice(l, 1);
							break;
						}
					}
					// Remove layer group entry if group is empty
					if (group.length === 0) {
						delete groupMap[groupName];
					}
				}
			}
		}

	}

	// Add layer to new group if a new group name is given
	if (props.groups !== undefined && props.groups !== null) {

		for (g = 0; g < props.groups.length; g += 1) {

			groupName = props.groups[g];

			group = groupMap[groupName];
			if (!group) {
				// Create new group entry if it doesn't exist
				group = groupMap[groupName] = [];
				group.name = groupName;
			}
			if (index === undefined) {
				// Add layer to end of group unless otherwise stated
				index = group.length;
			}
			// Add layer to its new layer group
			group.splice(index, 0, layer);

		}

	}
}
function _updateLayerGroups($canvas, data, layer, props) {
	var groupMap = data.layer.groups,
		group, groupName, g,
		index, l;

	// If group name is not changing
	if (!props) {

		props = layer;

	} else {

		// Remove layer from all of its associated groups
		if (props.groups !== undefined && layer.groups !== null) {
			for (g = 0; g < layer.groups.length; g += 1) {
				groupName = layer.groups[g];
				group = groupMap[groupName];
				if (group) {
					// Remove layer from its old layer group entry
					for (l = 0; l < group.length; l += 1) {
						if (group[l] === layer) {
							// Keep track of the layer's initial index
							index = l;
							// Remove layer once found
							group.splice(l, 1);
							break;
						}
					}
					// Remove layer group entry if group is empty
					if (group.length === 0) {
						delete groupMap[groupName];
					}
				}
			}
		}

	}

	// Add layer to new group if a new group name is given
	if (props.groups !== undefined && props.groups !== null) {

		for (g = 0; g < props.groups.length; g += 1) {

			groupName = props.groups[g];

			group = groupMap[groupName];
			if (!group) {
				// Create new group entry if it doesn't exist
				group = groupMap[groupName] = [];
				group.name = groupName;
			}
			if (index === undefined) {
				// Add layer to end of group unless otherwise stated
				index = group.length;
			}
			// Add layer to its new layer group
			group.splice(index, 0, layer);

		}

	}
}
function _updateLayerGroups ( $canvas , data , layer , props ) { var groupMap = data . layer . groups , group , groupName , g , index , l ; // If group name is not changing if ( ! props ) { props = layer ; } else { // Remove layer from all of its associated groups if ( props . groups !== undefined && layer . groups !== null ) { for ( g = 0 ; g < layer . groups . length ; g += 1 ) { groupName = layer . groups [ g ] ; group = groupMap [ groupName ] ; if ( group ) { // Remove layer from its old layer group entry for ( l = 0 ; l < group . length ; l += 1 ) { if ( group [ l ] === layer ) { // Keep track of the layer's initial index index = l ; // Remove layer once found group . splice ( l , 1 ) ; break ; } } // Remove layer group entry if group is empty if ( group . length === 0 ) { delete groupMap [ groupName ] ; } } } } } // Add layer to new group if a new group name is given if ( props . groups !== undefined && props . groups !== null ) { for ( g = 0 ; g < props . groups . length ; g += 1 ) { groupName = props . groups [ g ] ; group = groupMap [ groupName ] ; if ( ! group ) { // Create new group entry if it doesn't exist group = groupMap [ groupName ] = [ ] ; group . name = groupName ; } if ( index === undefined ) { // Add layer to end of group unless otherwise stated index = group . length ; } // Add layer to its new layer group group . splice ( index , 0 , layer ) ; } } }
Create or update the data map for the given layer and group type
Create or update the data map for the given layer and group type