Jump to content
Search Community

Draggable - Weird interaction with mousedown

Frank Mawn 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

Hi everyone,

 

I've been playing around with Draggable and noticed a strange behavior. 

The mousedown event works fine if I add the eventListener to a draggable element using the lockAxis setting, but the default "x,y" won't trigger it.

Am I missing something?

I've put a link to a codepen which illustrate the issue. The green box will trigger the mousedown (right-click) and the red one is not.

See the Pen Jrqvrb by FrankMawn (@FrankMawn) on CodePen

Link to comment
Share on other sites

Hi @Frank Mawn :)

 

Welcome to the forum.

 

Your pen seems to work correctly in Chrome and FF for me, but not in Edge. You might want to try this:

 

Draggable.create(".box:not(.lockaxis)", { type:"x,y", allowEventDefault: true });

 

I'm not entirely sure why the lock axis version is working correctly without that allowPreventDefault in there. Here's a similar question that may be helpful.

 

 

Others may jump in with additional details or thoughts. Happy tweening.

:)

 

  • Like 3
Link to comment
Share on other sites

11 hours ago, PointC said:

I'm not certain why that isn't documented.

 

If you ever look through the source code or inspect GSAP objects in your console, you'll find lots of undocumented stuff. Jack likes to keep stuff hidden until he sees people have a need for it. 

  • Like 2
  • Haha 2
Link to comment
Share on other sites

Looking at the source code makes me dizzy, but I've inspected GSAP objects many times and there is quite a bit of stuff in there. I think Jack uses the Tesla playbook: "It was always capable of that, but we're just turning that feature on & telling you about it now." ;)

  • Like 1
  • Haha 2
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...