Jump to content
GreenSock

Search In
  • More options...
Find results that contain...
Find results in...

marcelo2605

Members
  • Posts

    2
  • Joined

  • Last visited

marcelo2605's Achievements

Newbie

Newbie (1/14)

0

Reputation

  1. 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); } }
  2. I'm trying to allow user drag and rotate elements based on the the position the element is clicked. For that, I created two instances and keep one of them disabled. But it is returning an error:
×