Jump to content
Search Community

Draggable - Multi-touch support

matt.schuh test
Moderator Tag

Warning: Please note

This thread was started before GSAP 3 was released. Some information, especially the syntax, may be out of date for GSAP 3. Please see the GSAP 3 migration guide and release notes for more information about how to update the code to GSAP 3's syntax. 

Recommended Posts

I was looking to see if there's a way to support a multi-finger drag when I came across a year old forum post (http://greensock.com/forums/topic/11897-multi-finger-swipe-on-draggable/).  Instead of bringing it back I thought it better to post a new one.

Essentially, I need the ability for any number of fingers to be detected the same by draggable.  I am using draggable in a touchscreen kiosk to scroll a div within a bounding container.  There isn't any pinch zoom or other multi touch gestures that it would interfere with.  Users don't understand that the kiosks only work with a one finger drag at the moment, so the client wants to add multi-touch compatibility to dragging.  I know of hammer however everything is already written using draggable (I'm already using Hammer for swiping on different elements in a different manner), and I really like the smoothness of draggable.  In order to use hammer I'd have to rewrite draggable's throwprops which I'd rather not have to do.

 

Is there a way to allow multi finger touch or has that not been added?

 

Thanks!

Link to comment
Share on other sites

  • 2 years later...

 Hey... I need to make an app that need to be used by 6 simultaneous people so thats 12 hands at the same time. In testing draggable it seems to limit the number of simultaneous dragging to 5... can this be changed... is this a bug? I did assume it was because of the number of fingers on one hand.

Link to comment
Share on other sites

  • 3 years later...

I am by far a GSAP novice, but I have worked on a few kiosk interactives that clients have requested that draggable components work with multitouch. I am not sure if this will interfere with any other aspects of the gsap.draggable, but I have had some luck with using this little snippet I found somewhere a while back, sorry I can't find the original link. It allows the draggable to work normally even if additional touches are added during the drag.

function initDragContainer(){
    let dragCont = document.getElementByID('dragCont');
    let dragContParent = document.getElementByID('dragCont');
    let yBoundMin = -(.clientHeight-svgContBox.clientHeight);
    Draggable.create(svgCont,
        {   type:'y',
            bounds:{minY:yBoundMin,maxY:0},
            inertia: true,
            zIndexBoost: false,
            edgeResistance:.75,
 
})
 
function ignoreEvent(e){
    e.preventDefault();
    e.stopImmediatePropagation();
    if(e.preventManipulation){
      e.preventManipulation();
    }
    return false;
  }
 
  dragCont.addEventListener('touchstart',ignoreEvent,false);
  dragCont.addEventListener('touchend',ignoreEvent,false);
  • Thanks 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...