Closed greggman closed 1 year ago
Thanks for your feedback!
I have released version v0.5.0 just now.
In v0.5.0, The DraggableTitle
exposes the following new properties:
dragConfig
: Drag behavior, see more information in use-gesture doconDrag
: Actions triggered when dragging, see more information in use-gesture doconDragEnd
: Actions triggered when drag endsonDragStart
: Actions triggered when drag startsI'm trying to dupilicate this behavior. Is it possible?
Now just set filterTaps
to true
at dragConfig
, this is turned on by default.
I think you need a dynamic nodeList
, This way you don't need to pre-create 50 panes. When a file starts to be dragged, create a new pane, and it should be easy to tell the new pane that was just added which file to use.
I have written a simple example of a dynamic nodeList at codesandbox
Wow, thank you! I will check it out.
I have a component like this
You can see an example of this in VSCode. Imagine all the filenames on the left are made with the component above
https://user-images.githubusercontent.com/234804/198961223-9b8fec60-0b5a-45f7-99a5-43ad611b8683.mp4
When a component is clicked one thing happens. When a component is dragged, a different thing happens.
I'm trying to dupilicate this behavior. Is it possible?
At the moment I just pre-create 50 panes (pane0, pane1, pane2, ....). But they are not in the
rootPane
tree. I have an array of free pane names. All of the elements using the component above get the samenextFreePaneId
. This seems okay because only one of those elements will be dragged to make a new pane, at which point they'd all get a differetnnextFreePAneId
This almost works, when I click the component one thing happens, when I drag the component, a new pane is created.
I have 2 issues though:
After dragging, the component's onClick event fires. I need to prevent that click.
Is there some props or context state I can look at to see that I'm being dragged?
Have no way to tell the new pane that was just added which file to use
I have no way to tell a pane was even added
So I can't update my list of free pane ids.
Am I approaching this the right way? Any idea how I would solve this?
Maybe I could solve it by wrapping that component in another component that some how checks if it's being dragged and passs that as a prop to this component so it can stop setting onClick? That would solve but not 2 or 3.