Skip to content

Commit

Permalink
track vectors as array
Browse files Browse the repository at this point in the history
split new help panel from old inline help
tooltip+s support
  • Loading branch information
Amorano committed Aug 9, 2024
1 parent eca3d64 commit ba1112e
Show file tree
Hide file tree
Showing 5 changed files with 408 additions and 568 deletions.
64 changes: 31 additions & 33 deletions web/core/core_cozy_tips.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ const JTooltipWidget = (app, name, opts) => {
return w
}

if(app.extensionManager) {

app.registerExtension({
name: "jovimetrix.help.tooltips",
async getCustomWidgets() {
Expand Down Expand Up @@ -86,16 +84,21 @@ app.registerExtension({
// jovian tooltip
const widget_tooltip = (node?.widgets || [])
.find(widget => widget.type === 'JTOOLTIP');

if (!widget_tooltip) {
hideTooltip();
return;
}

const tips = widget_tooltip.options.default || {};
const inputSlot = this.isOverNodeInput(node, this.graph_mouse[0], this.graph_mouse[1], [0, 0]);

let tip;
let name;

if (inputSlot !== -1) {
const slot = node.inputs[inputSlot];
let tip = tips?.[slot.name];
tip = tips?.[slot.name];
if (slot.widget) {
const widget = node.widgets.find(w => w.name === slot.name);
if (widget && widget.type.startsWith('converted-widget')) {
Expand All @@ -105,38 +108,34 @@ app.registerExtension({
}
}
}

const name = `inputs_${inputSlot}`;
if (widget_previous != name) {
hideTooltip();
widget_previous = name;
}
return showTooltip(tip);
}

const outputSlot = this.isOverNodeOutput(node, this.graph_mouse[0], this.graph_mouse[1], [0, 0]);
if (outputSlot !== -1) {
let tip = tips?.['outputs']?.[outputSlot];
const name = `outputs_${outputSlot}`;
if (widget_previous != name) {
hideTooltip();
widget_previous = name;
name = `inputs_${inputSlot}`;
} else {
const outputSlot = this.isOverNodeOutput(node, this.graph_mouse[0], this.graph_mouse[1], [0, 0]);
if (outputSlot !== -1) {
tip = tips?.['outputs']?.[outputSlot];
name = `outputs_${outputSlot}`;
} else {
const widget = widgetGetHovered();
if (widget && !widget.element) {
name = widget.name;
tip = tips?.[name];
const def = widget.options?.default;
if (def) {
tip += ` (default: ${def})`;
}
}
}
return showTooltip(tip);
}

const widget = widgetGetHovered();
if (widget && !widget.element) {
let tip = tips?.[widget.name];
const def = widget.options?.default;
if (def) {
tip += ` (default: ${def})`;
}
if (widget_previous != widget.name) {
hideTooltip();
widget_previous = widget.name;
if (widget_previous != name) {
hideTooltip();
widget_previous = name;
if (tip) {
return showTooltip(tip);
}
return showTooltip(tip);
return;
} else {
return;
}
hideTooltip();
}.bind(app.canvas);
Expand All @@ -161,5 +160,4 @@ app.registerExtension({
},
});
},
});
}
});
246 changes: 0 additions & 246 deletions web/core/core_experiment.js

This file was deleted.

Loading

0 comments on commit ba1112e

Please sign in to comment.