You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When dealing with multiple targets, the onMouseUp event is triggered before the onClick event.
As far as I understood, the onMouseDownKeyed event is used to register the current target, which may then be used by onDragBy and onClick. The onMouseUp is then used to remove the current target. If onMouseUp is triggered before onClick, however, we can't tell who the target was.
Is this behaving as intended? Should I be using a different pattern to determine the target of the click event?
Looking at Internal.elm (line 70), it seems as if onClick should occur before onDragBy. Maybe the order of the list is being changed somewhere, or maybe Cmd.batch doesn't guarantee an order?
My use case for this was a graph editor. Nodes can be dragged around, and their labels could be edited when clicked.
The text was updated successfully, but these errors were encountered:
Yes, that is a valid use-case I didn't think about when supporting multiple targets. It seems that, indeed, Cmd.batch has no guarantee for the order, and I can't think of a way to send multiple cmds sequentially (using Task.sequence would result in a Cmd (List msg), which is not ok).
I guess that the solution would be to pass the key to onClick as well. Or maybe there is a more elegant solution, I'll think about it.
Having the key with the onClick event would be very handy :)
It should be possible just by adding the key to the DraggingTentative and Dragging states. If you think this is the way to go, I could submit a pull request.
When dealing with multiple targets, the
onMouseUp
event is triggered before theonClick
event.As far as I understood, the
onMouseDownKeyed
event is used to register the current target, which may then be used byonDragBy
andonClick
. TheonMouseUp
is then used to remove the current target. IfonMouseUp
is triggered beforeonClick
, however, we can't tell who the target was.Is this behaving as intended? Should I be using a different pattern to determine the target of the click event?
Looking at Internal.elm (line 70), it seems as if
onClick
should occur beforeonDragBy
. Maybe the order of the list is being changed somewhere, or maybeCmd.batch
doesn't guarantee an order?My use case for this was a graph editor. Nodes can be dragged around, and their labels could be edited when clicked.
The text was updated successfully, but these errors were encountered: