Jump to content
Search Community

Pretty bad performance of Draggable.create

Bruno Capdevila test
Moderator Tag

Recommended Posts

I am developing a game using

- react 18

- latest gsap

- styled components

 

At some point I create a bunch of draggables by doing

Draggable.create('.token-card-view', {
        type: 'x,y',
        bounds: '#action-menu-view',
        edgeResistance: 0.65,
        dragResistance: 0.1,
        activeCursor: 'grabbing',
        onDragStart: function () { ... },
        onDrag: function () { ... },
        onDragEnd: function () { ... },
      })
    );

There are right now exactly 7 elements with token-card-view class.

When profiling I have the following functions taking way too much time

 

I am unable right now to re-create a pen that extracts the piece of my application causing this.

Things I can think of 

- our styles do using cqmin
- out styles do using some calc
Still, it does not seem too heavy to cause this.

image.thumb.png.2d3369cd4c202624dccab84ad1b3e2e3.png

Any insight ? recommendation ?

 

 

 

Link to comment
Share on other sites

Are you just saying that the initial creation seems to take longer than you'd expect? Actual dragging is fine, right? There are definitely calculations that must be done initially to figure out exactly where the bounds must be so that during dragging it's nice and fast. 

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...