Jump to content
Search Community

Draggable, double usage in one container. - SVG

chriswyl test
Moderator Tag

Go to solution Solved by Diaco,

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

Hello,

 

I'm trying to resolve this problem.

 

I've one "main" draggable element which includes 3 elements.

One with litter "M" - using for moving main element, and second with 'gradient' (is draggable too) to change "crop".

Last element greenbox is now not usable.

I want drag main element only when I use yellow box with "M"

But  when I drag 'green' element I don't need drag only this element without change position of all object.

See the Pen dPaxXw by amonk (@amonk) on CodePen

Link to comment
Share on other sites

  • Solution

Hi chriswyl  :)

 

pls add this to your second draggable creation Vars  :

onPress: function(e) { e.stopPropagation() }

like this :

Draggable.create("#outer", { type:"x,y" , throwProps:true });

Draggable.create("#inner", { 
  type: "x,y",
  throwProps:true,
  bounds:{minX:-100, maxX:0, minY:-150, maxY:0},
  onPress: function(e) { e.stopPropagation() }
  });
  • Like 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...