dist/jcanvas-handles.js
function addPathGuides($canvas, parent) {
	var handles = parent._handles,
		prevHandle, nextHandle, otherHandle,
		handle, h,
		guide, guideProps;
	guideProps = $.extend({}, parent.guide, {
		layer: true,
		draggable: false,
		type: 'line'
	});
	if (parent._method === $.fn.drawQuadratic) {
		$canvas.addLayer(guideProps);
		parent._guide = $canvas.getLayer(-1);
		$canvas.moveLayer(parent._guide, -handles.length - 1);
	} else if (parent._method === $.fn.drawBezier) {
		parent._guides = [];
		for (h = 0; h < handles.length; h += 1) {
			handle = handles[h];
			nextHandle = handles[h + 1];
			prevHandle = handles[h - 1];
			otherHandle = null;
			if (nextHandle !== undefined) {
				// If handle is a start/end point and next handle is a control point
				if (handle._xProp.indexOf('x') === 0 && nextHandle._xProp.indexOf('cx') === 0) {
					otherHandle = nextHandle;
				}
			} else if (prevHandle !== undefined) {
				if (prevHandle._xProp.indexOf('cx') === 0 && handle._xProp.indexOf('x') === 0) {
					otherHandle = prevHandle;
				}
			}
			if (otherHandle !== null) {
				$canvas.addLayer(guideProps);
				guide = $canvas.getLayer(-1);
				guide._handles = [handle, otherHandle];
				parent._guides.push(guide);
				$canvas.moveLayer(guide, -handles.length - 1);
			}
		}
	}
	updatePathGuides(parent);
}
function addPathGuides($canvas, parent) {
	var handles = parent._handles,
		prevHandle, nextHandle, otherHandle,
		handle, h,
		guide, guideProps;
	guideProps = $.extend({}, parent.guide, {
		layer: true,
		draggable: false,
		type: 'line'
	});
	if (parent._method === $.fn.drawQuadratic) {
		$canvas.addLayer(guideProps);
		parent._guide = $canvas.getLayer(-1);
		$canvas.moveLayer(parent._guide, -handles.length - 1);
	} else if (parent._method === $.fn.drawBezier) {
		parent._guides = [];
		for (h = 0; h < handles.length; h += 1) {
			handle = handles[h];
			nextHandle = handles[h + 1];
			prevHandle = handles[h - 1];
			otherHandle = null;
			if (nextHandle !== undefined) {
				// If handle is a start/end point and next handle is a control point
				if (handle._xProp.indexOf('x') === 0 && nextHandle._xProp.indexOf('cx') === 0) {
					otherHandle = nextHandle;
				}
			} else if (prevHandle !== undefined) {
				if (prevHandle._xProp.indexOf('cx') === 0 && handle._xProp.indexOf('x') === 0) {
					otherHandle = prevHandle;
				}
			}
			if (otherHandle !== null) {
				$canvas.addLayer(guideProps);
				guide = $canvas.getLayer(-1);
				guide._handles = [handle, otherHandle];
				parent._guides.push(guide);
				$canvas.moveLayer(guide, -handles.length - 1);
			}
		}
	}
	updatePathGuides(parent);
}
function addPathGuides ( $canvas , parent ) { var handles = parent . _handles , prevHandle , nextHandle , otherHandle , handle , h , guide , guideProps ; guideProps = $ . extend ( { } , parent . guide , { layer : true , draggable : false , type : 'line' } ) ; if ( parent . _method === $ . fn . drawQuadratic ) { $canvas . addLayer ( guideProps ) ; parent . _guide = $canvas . getLayer ( - 1 ) ; $canvas . moveLayer ( parent . _guide , - handles . length - 1 ) ; } else if ( parent . _method === $ . fn . drawBezier ) { parent . _guides = [ ] ; for ( h = 0 ; h < handles . length ; h += 1 ) { handle = handles [ h ] ; nextHandle = handles [ h + 1 ] ; prevHandle = handles [ h - 1 ] ; otherHandle = null ; if ( nextHandle !== undefined ) { // If handle is a start/end point and next handle is a control point if ( handle . _xProp . indexOf ( 'x' ) === 0 && nextHandle . _xProp . indexOf ( 'cx' ) === 0 ) { otherHandle = nextHandle ; } } else if ( prevHandle !== undefined ) { if ( prevHandle . _xProp . indexOf ( 'cx' ) === 0 && handle . _xProp . indexOf ( 'x' ) === 0 ) { otherHandle = prevHandle ; } } if ( otherHandle !== null ) { $canvas . addLayer ( guideProps ) ; guide = $canvas . getLayer ( - 1 ) ; guide . _handles = [ handle , otherHandle ] ; parent . _guides . push ( guide ) ; $canvas . moveLayer ( guide , - handles . length - 1 ) ; } } } updatePathGuides ( parent ) ; }
Add guides to path layer
Add guides to path layer