I have this structure, but the onMouseEnter & onMouseLeave are never triggered.
NodeFlowEditor(
events: NodeFlowEvents(
port: PortEvents(
onMouseEnter: (node, port) {
print("port: onMouseEnter: ${port.id}");
);
},
onMouseLeave: (node, port) {
print("port: onMouseLeave: ${port.id}");
},
)
)
);
I had to fix it by using portBuilder and wire the events by myself.
The onMouseEnter & onMouseLeave are not wired for the default port widget. I think they are missing in the default portWidget in file: vyuh_node_flow-0.27.3/lib/src/nodes/node_container.dart
// Port widget cascade:
// 1. port.buildWidget (per-instance builder)
// 2. portBuilder (global editor builder)
// 3. PortWidget (framework default)
final portWidget =
port.buildWidget(context, node) ??
(portBuilder != null
? portBuilder!(context, node, port)
: PortWidget<T>(
port: port,
theme: portTheme,
isConnected: isConnected,
snapDistance: portSnapDistance,
controller: controller,
nodeId: node.id,
isOutput: isOutput,
nodeBounds: nodeBounds,
onTap: onPortTap != null
? (p) => onPortTap!(node.id, p.id, isOutput)
: null,
onHover: onPortHover != null
? (data) => onPortHover!(node.id, data.$1.id, data.$2)
: null,
onContextMenu: onPortContextMenu != null
? (pos) => onPortContextMenu!(node.id, port.id, pos)
: null,
));
I fixed it in my NodeBuilder like this:
onHover: (data) {
final isHovered = data.$2;
if (isHovered) {
onMouseEnter?.call(node, port);
} else {
onMouseLeave?.call(node, port);
}
},
I have this structure, but the onMouseEnter & onMouseLeave are never triggered.
I had to fix it by using portBuilder and wire the events by myself.
The onMouseEnter & onMouseLeave are not wired for the default port widget. I think they are missing in the default portWidget in file: vyuh_node_flow-0.27.3/lib/src/nodes/node_container.dart
I fixed it in my NodeBuilder like this: