more nodes2 stuff, plus fix a regression on nodes 1
This commit is contained in:
+1
-1
@@ -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
|
||||
|
||||
@@ -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)
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user