Jump to content
Search Community

JesusTheHun

Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by JesusTheHun

  1. Silly mistake, my bad.

    What if I actually needed a re-render, is there a way?

     

    Edit :

    I tried in my original code and it doesn't work. Yet I see no difference.

    As I drag I want to update the viewbox of the parent svg. I made a simplified yet (I assume) correct example here https://codesandbox.io/s/react-gsap-draggable-forked-ivt18?file=/index.js

    Of course it's a dumb example I have some business logic around the viewbox update, it's just a more complex `onMove` function, nothing crazy.

  2. See case : https://codesandbox.io/s/react-gsap-draggable-forked-02s6z?file=/index.js

     

    As you rotate, the rotation value is passed up in the hierarchy, triggering a refresh of the parent component, and therefore of the child component. All values are reset and the current dragging is interrupted.
    This does not happen if the state is held in the Tile component itself, but I want to separate those concerns.

    I also tried to memoized the component, but the drag is still lost.

     

    Is there a way to recover the current dragging ?

  3. I'm using Draggable.create(arrayOfElements, {...}) to make a set of SVG g elements draggable.

    The trigger of each element is a child of said element. One trigger is supposed to drag one element.

     

    So I tried { trigger: ".draggable" }. When I do that, any .draggable trigger the drag of all elements (from arrayOfElements) instead of its parent only.
    I could of course create the drag on the children directly, but then I have to move everything else manually.

     

    Should I do an instance of Draggable for each element instead of for the entire array ? Does that bring any performance issue ?

×
×
  • Create New...