more nodes2 stuff, plus fix a regression on nodes 1

This commit is contained in:
Chris
2026-05-28 19:48:12 +10:00
parent 281f07a3bc
commit 04740c9ec0
3 changed files with 10 additions and 4 deletions
+1 -1
View File
@@ -13,11 +13,11 @@ function nodeElement(node) {
export function addMouseEvents(node) {
const element = nodeElement(node)
const header = element.querySelector(`div[data-testid="node-header-${node.id}"]`)
if (!element) {
Logger.log_problem(`Could not find node element for node ${node.id}`)
return
}
const header = element.querySelector(`div[data-testid="node-header-${node.id}"]`)
element.addEventListener("mouseenter", () => {
node.mouseOver = true
shared.mouseOverNode = node
+8 -2
View File
@@ -19,7 +19,7 @@ import { ue_callbacks, for_all_nodes } from "./recursive_callbacks.js";
import { nodes2_overlay, addMouseEvents } from "./ue_nodes2.js";
/*
All nodes need the onDrawTitleBar method so they can show if they are broadcasting UE data.
All nodes (pre Nodes 2.0) need the onDrawTitleBar method so they can show if they are broadcasting UE data.
*/
function add_methods_to_all_nodes(node) {
if (node.ue_methods_added) return Logger.log_problem(`Node ${node.id} already has UE methods added`);
@@ -41,6 +41,12 @@ function add_methods_to_all_nodes(node) {
original_onMouseLeave?.apply(this, arguments)
shared.linkRenderController.node_over_changed()
}
const original_onDrawTitle = node.onDrawTitle;
node.onDrawTitle = function(ctx) {
title_bar_additions(this, ctx)
original_onDrawTitle?.apply(this, arguments)
}
}
node.ue_methods_added = true;
@@ -191,7 +197,7 @@ app.registerExtension({
}
ue_callbacks.register_allnode_callback('afterConfigureGraph', ()=>{
setTimeout(for_all_nodes, 1000, addMouseEvents)
if (running_nodes2()) setTimeout(for_all_nodes, 1000, addMouseEvents)
})
},
+1 -1
View File
@@ -77,7 +77,7 @@ export function nodes_not_my_color(node, already_limited_to) {
return [...nodes_in];
}
export function title_bar_additions(node, ctx, title_height) {
export function title_bar_additions(node, ctx, title_height=30) {
if (node_can_broadcast(node)) {
const color = titlebar_color(node)