I am trying to send back and display the active object / active group by pressing a button in java java, I can send back the active object, but get problems in the group.
Here is my code
$('#send-backward').click(function() {
var activeObject=canvas.getActiveObject(),
activeGroup=canvas.getActiveGroup();
if (activeObject) {
canvas.sendBackwards(activeObject);
canvas.renderAll();
}
else if (activeGroup) {
canvas.getActiveGroup().forEachObject(function(o){canvas.sendBackwards(o); });
canvas.renderAll();
}
});
$('#bring-forward').click(function() {
var activeObject=canvas.getActiveObject(),
activeGroup=canvas.getActiveGroup();
if (activeObject) {
canvas.bringForward(activeObject);
canvas.renderAll();
}
else if (activeGroup) {
canvas.getActiveGroup().forEachObject(function(o){canvas.bringForward(o); });
canvas.renderAll();
}
});
Jsfiddle
with this code push forward normally, but the problem is sending back
and try another code -
jsfiddle this code works weird, it makes a copy of the group
Thank you in advance
source
share