Hi I want to have Layers sort control like on photoshop using FabricJS
I have this solution but it's not working well when you have more than 3 objects on canvas:
$("#containerLayers").sortable({
change: function(event, ui){
$( "#containerLayers li" ).each(function(index,list){
if(objectArray[$(list).attr('id')]){
canvas.moveTo(objectArray[$(list).attr('id')],index);
}
});
canvas.renderAll();
}
});
Here is other parts of code: https://jsfiddle.net/peLcju2h/16/
does anyone have a better solution than this?