#914 Fix for issue identifying node wehen the id of the node starts with a digit

This commit is contained in:
knsv
2019-08-27 12:16:11 -07:00
parent 34d3b85227
commit a48a306fe8
2 changed files with 31 additions and 1 deletions

View File

@@ -61,6 +61,10 @@ export const addVertex = function (_id, text, type, style, classes) {
}
vertices[id].text = txt
} else {
if (!vertices[id].text) {
vertices[id].text = _id
}
}
if (typeof type !== 'undefined') {
vertices[id].type = type
@@ -175,7 +179,9 @@ export const setDirection = function (dir) {
* @param className Class to add
*/
export const setClass = function (ids, className) {
ids.split(',').forEach(function (id) {
ids.split(',').forEach(function (_id) {
let id = _id
if (_id[0].match(/\d/)) id = 's' + id
if (typeof vertices[id] !== 'undefined') {
vertices[id].classes.push(className)
}