Jump to content

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

Thomas Devolder

  • Posts

  • Joined

  • Last visited

Thomas Devolder's Achievements

  1. Hi @PointC Thank you for your help. The onDrag function works but is there a way I can get the value of the current rotation of the square inside the onDrag function? I tried (e)=> {console.log(e)} but I can't find a rotation value inside the object.
  2. So I am trying to rotate a circle and snap it to 90 degrees but I can rotate it but It doesn't trigger the onDrag en snap function. I don't know why, I also don't get any errors. let rotationSnap = 90; Draggable.create(vinyl, { type:"rotation", OnDrag: () => console.log('works'), snap: function(endValue) { console.log(endValue); console.log(Math.round(endValue / rotationSnap) * rotationSnap) //this function gets called when the mouse/finger is released and it plots where rotation should normally end and we can alter that value and return a new one instead. This gives us an easy way to apply custom snapping behavior with any logic we want. In this case, just make sure the end value snaps to 90-degree increments but only when the "snap" checkbox is selected. return Math.round(endValue / rotationSnap) * rotationSnap; } }) }