Skip to content

Commit e626bca

Browse files
committed
Support highlighting selected nodes
1 parent 29768db commit e626bca

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

static/view-grapher.css

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@
9393
.node-item-function text { fill: #dfdfdfdf; }
9494
.node-item-function:hover { cursor: pointer; }
9595
.node-item-function:hover path { fill: #666666; }
96-
96+
9797
.node-item-type path { fill: #303030; }
9898
.node-item-type text { fill: #dfdfdf; }
9999
.node-item-type:hover { cursor: pointer; }
@@ -134,3 +134,6 @@
134134
.node-item-type-quantization path { fill: rgb(80, 40, 0, 0.7); }
135135
.node-item-type-custom path { fill: rgb(64, 64, 64, 0.7); }
136136
}
137+
138+
/* render selected nodes */
139+
.highlight path { stroke: #FF6347; stroke-width: 2px;}

static/view-sidebar.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ sidebar.Sidebar = class {
99
this._host = host;
1010
this._id = id ? ('-' + id) : '';
1111
this._stack = [];
12+
this.node_owner = null;
1213
this._closeSidebarHandler = () => {
1314
this._pop();
1415
};
@@ -64,6 +65,10 @@ sidebar.Sidebar = class {
6465
container.style.width = '100%';
6566
container.focus();
6667
}
68+
if (this.node_owner) {
69+
this.node_owner.element.classList.remove('highlight');
70+
this.node_owner = null;
71+
}
6772
}
6873

6974
_deactivate() {
@@ -121,6 +126,11 @@ sidebar.Sidebar = class {
121126
container.style.width = 'max(40vw, calc(100vw - 500px))';
122127
}
123128
}
129+
130+
// used if the side bar is invoked to show a node's property
131+
mark_node_owner(node) {
132+
this.node_owner = node;
133+
}
124134
};
125135

126136
sidebar.NodeSidebar = class {

static/view.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -821,6 +821,10 @@ view.View = class {
821821
nodeSidebar.toggleInput(input.name);
822822
}
823823
this._sidebar.open(nodeSidebar.render(), 'Node Properties');
824+
825+
var node = this.modifier.name2ViewNode.get(modelNodeName);
826+
node.element.classList.add('highlight');
827+
this._sidebar.mark_node_owner(node);
824828
}
825829
catch (error) {
826830
const content = " in '" + this._model.identifier + "'.";

0 commit comments

Comments
 (0)