The source project of this merge request has been removed.
This MR is based on and a superset of !301 (closed). I tried to make minimal changes to the C code base.
-help.pd
files in the K12 directory to extract the content of the tooltips.-help.pd
files to extract the information in the pd META
canvas. The content of the tooltip is stored in a global object called k12_xlet_tt
, structured like this:{
"abstraction1": {
"i0": "content...",
"i1": "content...",
"o0": "content..."
},
"abstraction2": {
...
}, ...
}
gui_gobj_new
function from JS receives the rtext-text of the graph object from the C side (which is essentially the name of the K12 abstraction), and stores it in the DOM using the ttid
attribute. This way, Purr Data knows which K12 abstraction is our new gobj representing, making it possible to retrieve tooltip content from k12_xlet_tt
. Relevant changes include:
pdgui.js
, an additional parameter for gui_gobj_new
to receive the rtext-text;g_graph.c
's graph_vis
function , a call to rtext_gettext
before vmessing gui_obj_new
.gui_gobj_highlight_io
to play the cute animation. We just modify gui_highlight_io
to retrieve tooltip content from k12_xlet_tt
using the ttid
attribute, and then display the tooltip div at the appropriate position. Relevant changes include:
pd_canvas.html
, there's a new <div>
to contain the tooltip.pdgui.js
's gui_gobj_highlight_io
function now shows the tooltip div when the cursor is hovering over xlets. For inlets, the tooltip will be located below the cursor, because there will be guaranteed space; the opposite for outlets.pdgui.js
's gui_gobj_configure_io
function hides the tooltip div, since this function is called every time when the cursor is moving out of the xlet.gui_vmess
to gui_gobj_new
. When this happens, the <g>
will not have a correct ttid
attribute and thus won't display the tooltip. I fail to find a pattern when this will happen. It's always the same abstractions.gui_gobj_new
calls for demo_sequencer_complex.pd
and the result is as below.