* Add an expand/collapse button to a group node * * @param selection The group node selection. * @param d Info about the node being rendered. * @param sceneElement polymer element.
(selection, d: render.RenderNodeInfo, sceneElement)
| 244 | * @param sceneElement <tf-graph-scene> polymer element. |
| 245 | */ |
| 246 | function addButton(selection, d: render.RenderNodeInfo, sceneElement) { |
| 247 | let group = tf_graph_common.selectOrCreateChild( |
| 248 | selection, |
| 249 | 'g', |
| 250 | Class.Node.BUTTON_CONTAINER |
| 251 | ); |
| 252 | tf_graph_common.selectOrCreateChild( |
| 253 | group, |
| 254 | 'circle', |
| 255 | Class.Node.BUTTON_CIRCLE |
| 256 | ); |
| 257 | tf_graph_common |
| 258 | .selectOrCreateChild(group, 'path', Class.Node.EXPAND_BUTTON) |
| 259 | .attr('d', 'M0,-2.2 V2.2 M-2.2,0 H2.2'); |
| 260 | tf_graph_common |
| 261 | .selectOrCreateChild(group, 'path', Class.Node.COLLAPSE_BUTTON) |
| 262 | .attr('d', 'M-2.2,0 H2.2'); |
| 263 | (group as any).on('click', (d: any) => { |
| 264 | // Stop this event's propagation so that it isn't also considered a |
| 265 | // node-select. |
| 266 | (<Event>d3.event).stopPropagation(); |
| 267 | sceneElement.fire('node-toggle-expand', {name: d.node.name}); |
| 268 | }); |
| 269 | tf_graph_scene.positionButton(group, d); |
| 270 | } |
| 271 | /** |
| 272 | * Fire node-* events when the selection is interacted. |
| 273 | * |
no outgoing calls
no test coverage detected
searching dependent graphs…