Fixed! Here is the working code:
var rotationDrag = Draggable.create($(".draggable"), {
type: "rotation",
throwProps: true,
onPress: setDraggable,
});
$.each(rotationDrag, function(index) {
rotationDrag[index].disable();
});
var translateDrag = Draggable.create($(".draggable"), {
throwProps: true,
onPress: setDraggable,
});
function setDraggable(event) {
var index = rotationDrag.findIndex(i => i.target === this.target);
var isRotation = this.vars.type === "rotation";
var isCorner = event.target.className === 'rotate';
if (isCorner) {
if (!isRotation) {
translateDrag[index].disable();
rotationDrag[index].enable().startDrag(event);
}
} else if (isRotation) {
rotationDrag[index].disable();
translateDrag[index].enable().startDrag(event);
}
}