Jump to content
GreenSock

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

Search the Community

Showing results for tags 'draggaboe'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • GreenSock Forums
    • GSAP
    • Banner Animation
    • Jobs & Freelance
  • Flash / ActionScript Archive
    • GSAP (Flash)
    • Loading (Flash)
    • TransformManager (Flash)

Product Groups

  • Club GreenSock
  • TransformManager

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 1 result

  1. I have a draggable instance that snaps to y position based on an array. I would like to send out a global event onDragEnd as to what the final snapped position would be. I 'm using this approach, which currently is a little buggy, but I can probably make it more robust. Is there a more elegant method? const closest = (array, num) => { let i = 0; let minDiff = 1000; let ans; for (i in array) { let m = Math.abs(num - array); if (m < minDiff) { minDiff = m; ans = array; } } return ans; } onDragCompleteY(e) { let y = e.layerY; let arr = this.generateSnapDistances(); let finalNum = closest(arr, y); let SNAPPED_INDEX = arr.indexOf(finalNum); }
×