-
Notifications
You must be signed in to change notification settings - Fork 327
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
Move output ports to edges level #12133
base: develop
Are you sure you want to change the base?
Conversation
Spurious pointerenter events with invalid *Key payloads were causing invalid state of the keyboard provider.
🧪 Storybook is successfully deployed!📊 Dashboard:
|
Oops, not exactly what I wanted, sorry for ping. |
76a6a93
to
ffc82b0
Compare
onBlur(() => { | ||
graph.setNodeHovered(nodeId.value, false) | ||
updateNodeHover(undefined) | ||
}) |
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.
Is it this component's blur or window/document blur? I think it should be the latter, but the name does not say it.
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.
Renamed to onWindowBlur
, you are right.
@@ -464,8 +478,8 @@ const showMenuAt = ref<{ x: number; y: number }>() | |||
:class="nodeClass" | |||
:data-node-id="nodeId" | |||
@pointerdown.stop | |||
@pointerenter="((nodeHovered = true), updateNodeHover($event))" | |||
@pointerleave="((nodeHovered = false), updateNodeHover(undefined))" | |||
@pointerenter="(graph.setNodeHovered(nodeId, true), updateNodeHover($event))" |
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.
Perhaps setNodeHovered
should be just a part of updateNodeHover
? I think I see these two always called together.
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.
updateNodeHover
is used on its own once, though, on pointer move.
watch(isVisualizationVisible, (val) => { | ||
if (!val) { | ||
visualizationHovered.value = false | ||
} | ||
}) |
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.
It's strange this is needed; hiding visualization itself should emit "pointerleave", effectively setting visualizationHovered to false. Is this needed due to the modifiers problem? If yes, then add a comment here.
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.
Yeah, I wasn’t paying enough attention here. We’re not getting pointerleave for whatever reason. I just added a comment about it.
setSoleSelected: (element: T) => { | ||
setSelection(new Set([element])) | ||
onSoleSelected?.(element) | ||
}, |
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 think these names are a bit confusing. setSoleSelected
technically should be the same as setSelection
with a single node. But only the former calls onSoleSelected
.
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.
You are right, I removed setSoleSelected
, onSoleSelected
is now triggered if we pass a single element.
|
||
const blurHandlers = new Set<() => void>() | ||
|
||
/** | ||
* Register a callback to be called when the window is blurred. | ||
* The callback will be called when the window is blurred, and will be removed when the component is unmounted. | ||
*/ | ||
export function onBlur(callback: () => void) { | ||
blurHandlers.add(callback) | ||
onUnmounted(() => { | ||
blurHandlers.delete(callback) | ||
}) | ||
} | ||
|
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.
It's the same as useEvent(window, 'blur')
, isn't it? Because useEvent
also removes itself (on scope disposal, but it's effectively same as unmount).
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.
Yes, but here we have a single event handler per application instead of multiple event handlers per node. We use the same pattern for autoBlur, for performance reasons.
const nodeIdsWithOutputPorts = computed(() => | ||
Array.from(graph.db.nodeIdToNode.entries()) | ||
.filter(([_, node]) => node.type !== 'output') | ||
.map(([id]) => id), | ||
) |
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.
Why not use graph.db.nodeOutputPorts
?
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 guess no particular reason, just reused the code from some other place. Changed it now as suggested.
getting pointerleave events
a61697e
to
281f86f
Compare
Pull Request Description
Fixes #11922
ports-on-edges-layer.mp4
copy-error-button-works.mp4
Important Notes
See #12131 and #12132.
Checklist
Please ensure that the following checklist has been satisfied before submitting the PR:
Scala,
Java,
TypeScript,
and
Rust
style guides. In case you are using a language not listed above, follow the Rust style guide.
or the Snowflake database integration, a run of the Extra Tests has been scheduled.