Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
All ways of creating node (+ button, dragging out edges) #8341
All ways of creating node (+ button, dragging out edges) #8341
Changes from 6 commits
d467d09
8c3e90b
9da34fc
36a5c29
ff807c7
2ce23eb
2859ef4
d2d0854
d6cc6af
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like this is an unused class, and doesn't match component name. Use
PlusButton
class here, as it makes tests and debugging easier if we keep that convention everywhere.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is an atypical component definition. Use
<script setup lang="ts">
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic seems wrong to me, as
lastClickTime
is set within the timer callback only. Isn't it true that if the timer callback was allowed to execute in the first place, then the event wasn't a double-click?Also, delaying a click handler just to allow for doubleclick action is a really bad UX. The doubleclick can only really be used in cases where the first click handler can be executed immediately anyway, e.g. allowing the node to be selected, only then to start editing it after second click. In your case, I believe it would mean first click starts edge drag, but then subsequent doubleclick simply "overrides" that action with edge creation and predefined position.
Also for handling that, you can use builtin events instead of relying on your own timer. For example, a
click
provides adetail
field, which tells you about which click in a sequence it is (1 for first, 2 for doubleclick etc.). There is also a dedicateddblclick
event, though I'd rather use thedetail
field instead of two handlers (becauseclick
will fire again together withdblclick
).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed the delay for now as for my use case it is not relevant either way.
It seems
detail
does not work forpointerdown
events, as it is always zero. So I left this to support usage in those events.