$.jCanvas.defaults.fromCenter = false;
var $comicCanvas = $('#comic-canvas'); // <canvas id="comic-canvas" height="590" width="767">
var $savedComicCanvas = $('#saved-comic-canvas'); //<canvas id="saved-comic-canvas" width="767" height="129">
var $stickFigure = $('#stick-figure');

$(document).on('dragstart', function(e) {
	var target = e.target;
	if (target.className.includes('draggable') == false) {return};
	e.dataTransfer = e.originalEvent.dataTransfer;
	e.dataTransfer.setData('text/plain', target.src);
});

$comicCanvas.on('dragover', function(e) {
	e.preventDefault();
	e.dataTransfer = e.originalEvent.dataTransfer;
	e.dataTransfer.dropEffect = 'move';
})

$comicCanvas.on('drop', function(e) {
	e.preventDefault();
	e.dataTransfer = e.originalEvent.dataTransfer;
	var data = e.dataTransfer.getData('text');
	console.log(data);
	var x = e.pageX - $comicCanvas.offset().left;
	var y = e.pageY - $comicCanvas.offset().top;
	addLayer(data, x, y);
});

function addLayer(src, x, y) {
	if (src.includes('backgrounds')) {
		x = 0;
		y = 0;
		var draggable = false;
	} 
	else {var draggable = true};

	$comicCanvas.addLayer({
		type: 'image',
		source: src,
		x: x, y: y,
		draggable: true
	}).drawLayers();
}

@@ -676,16 +676,17 @@
 ve';%0D%0A%7D)
+;
 %0D%0A%0D%0A$com
@@ -1103,19 +1103,38 @@
 ;%0D%0A%09
-%7D 
+%09var index = 0;
 %0D%0A%09
+%7D 
 else %7B
+%0D%0A%09%09
 var 
@@ -1149,16 +1149,40 @@
 e = true
+%0D%0A%09%09var index = null;%0D%0A%09
 %7D;%0D%0A%0D%0A%09$
@@ -1271,16 +1271,33 @@
 le: true
+,%0D%0A%09%09index: index
 %0D%0A%09%7D).dr

Set index of background layers to 0