Skip to content

Commit

Permalink
[trees-js] feed the html tooltip blackboard access data (#123)
Browse files Browse the repository at this point in the history
  • Loading branch information
stonier authored Dec 2, 2019
1 parent 2215c8c commit e163cbf
Show file tree
Hide file tree
Showing 3 changed files with 26,750 additions and 26,700 deletions.
32 changes: 25 additions & 7 deletions js/py_trees-0.5.1.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,12 +107,30 @@ joint.shapes.trees.NodeView = joint.dia.ElementView.extend({
"</span><br/>"
data = this.model.get('data')
for (var key in data) {
this.$box.find('div.html-tooltip')[0].innerHTML +=
"<span><b>" +
key +
": </b>" +
data[key] +
"</span><br/>"
// Not a reliable way of checking for types, but since
// the user has control over the input (fundamentals or arrays or dicts)
// this will do. JS has *no* reliable way. See also:
// http://tobyho.com/2011/01/28/checking-types-in-javascript/
if (data[key].constructor == Object) {
} else if (Array.isArray(data[key])) {
this.$box.find('div.html-tooltip')[0].innerHTML +=
"<span><b>" +
key +
":</b></span><br/>"
for (var index in data[key]) {
this.$box.find('div.html-tooltip')[0].innerHTML +=
"<span>&nbsp;&nbsp;" +
data[key][index] +
"</span><br/>"
}
} else {
this.$box.find('div.html-tooltip')[0].innerHTML +=
"<span><b>" +
key +
": </b>" +
data[key] +
"</span><br/>"
}
}
scale = this.paper.scale() // sx, sy
offset = this.paper.translate() // tx, ty
Expand Down Expand Up @@ -1255,7 +1273,7 @@ var py_trees = (function() {
} else if ( event.get('significant') ) {
colour = 'white'
} else {
colour = 'grey'
colour = 'green' // grey doesn't sufficiently distinguish itself from white
}
event.attr({
body: {
Expand Down
Loading

0 comments on commit e163cbf

Please sign in to comment.