diff --git a/src/jsmind.graph.js b/src/jsmind.graph.js index b1873eb1..3eea7e8a 100644 --- a/src/jsmind.graph.js +++ b/src/jsmind.graph.js @@ -59,11 +59,16 @@ class SvgGraph { } this.lines.length = 0; } - draw_line(pout, pin, offset, color) { + draw_line(pout, pin, offset, color, classList) { var line = SvgGraph.c('path'); line.setAttribute('stroke', color || this.opts.line_color); line.setAttribute('stroke-width', this.opts.line_width); line.setAttribute('fill', 'transparent'); + if (classList) { + classList.forEach(className => { + line.classList.add(className); + }); + } this.lines.push(line); this.e_svg.appendChild(line); this.drawing( diff --git a/src/jsmind.view_provider.js b/src/jsmind.view_provider.js index 325a730c..9b09211f 100644 --- a/src/jsmind.view_provider.js +++ b/src/jsmind.view_provider.js @@ -505,6 +505,11 @@ export class ViewProvider { this._reset_node_custom_style(node._data.view.element, node.data); } _reset_node_custom_style(node_element, node_data) { + if (Array.isArray(node_data['nodeClassList'])) { + node_data['nodeClassList'].forEach(className => { + node_element.classList.add(className); + }); + } if ('background-color' in node_data) { node_element.style.backgroundColor = node_data['background-color']; } @@ -586,6 +591,7 @@ export class ViewProvider { var pin = null; var pout = null; var color = null; + var classList = null; var _offset = this.get_view_offset(); for (var nodeid in nodes) { node = nodes[nodeid]; @@ -598,7 +604,10 @@ export class ViewProvider { pin = this.layout.get_node_point_in(node); pout = this.layout.get_node_point_out(node.parent); color = node.data['leading-line-color']; - this.graph.draw_line(pout, pin, _offset, color); + classList = Array.isArray(node.data['lineClassList']) + ? node.data['lineClassList'] + : null; + this.graph.draw_line(pout, pin, _offset, color, classList); } } // Drag the whole mind map with your mouse, when it's larger that the container