|
|
@ -107,6 +107,7 @@ class Node { |
|
|
if (!options) { |
|
|
if (!options) { |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// basic options
|
|
|
// basic options
|
|
|
if (options.id !== undefined) {this.id = options.id;} |
|
|
if (options.id !== undefined) {this.id = options.id;} |
|
|
|
|
|
|
|
|
@ -114,7 +115,6 @@ class Node { |
|
|
throw "Node must have an id"; |
|
|
throw "Node must have an id"; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// set these options locally
|
|
|
// set these options locally
|
|
|
// clear x and y positions
|
|
|
// clear x and y positions
|
|
|
if (options.x !== undefined) { |
|
|
if (options.x !== undefined) { |
|
|
@ -144,7 +144,12 @@ class Node { |
|
|
// load the images
|
|
|
// load the images
|
|
|
if (this.options.image !== undefined) { |
|
|
if (this.options.image !== undefined) { |
|
|
if (this.imagelist) { |
|
|
if (this.imagelist) { |
|
|
this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id); |
|
|
|
|
|
|
|
|
if (typeof this.options.image === 'string') { |
|
|
|
|
|
this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.imageObj = this.imagelist.load(this.options.image.unselected, this.options.brokenImage, this.id); |
|
|
|
|
|
this.imageObjAlt = this.imagelist.load(this.options.image.selected, this.options.brokenImage, this.id); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
throw "No imagelist provided"; |
|
|
throw "No imagelist provided"; |
|
|
@ -295,7 +300,7 @@ class Node { |
|
|
|
|
|
|
|
|
updateShape(currentShape) { |
|
|
updateShape(currentShape) { |
|
|
if (currentShape === this.options.shape && this.shape) { |
|
|
if (currentShape === this.options.shape && this.shape) { |
|
|
this.shape.setOptions(this.options, this.imageObj); |
|
|
|
|
|
|
|
|
this.shape.setOptions(this.options, this.imageObj, this.imageObjAlt); |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
// choose draw method depending on the shape
|
|
|
// choose draw method depending on the shape
|
|
|
@ -307,7 +312,7 @@ class Node { |
|
|
this.shape = new Circle(this.options, this.body, this.labelModule); |
|
|
this.shape = new Circle(this.options, this.body, this.labelModule); |
|
|
break; |
|
|
break; |
|
|
case 'circularImage': |
|
|
case 'circularImage': |
|
|
this.shape = new CircularImage(this.options, this.body, this.labelModule, this.imageObj); |
|
|
|
|
|
|
|
|
this.shape = new CircularImage(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); |
|
|
break; |
|
|
break; |
|
|
case 'database': |
|
|
case 'database': |
|
|
this.shape = new Database(this.options, this.body, this.labelModule); |
|
|
this.shape = new Database(this.options, this.body, this.labelModule); |
|
|
@ -325,7 +330,7 @@ class Node { |
|
|
this.shape = new Icon(this.options, this.body, this.labelModule); |
|
|
this.shape = new Icon(this.options, this.body, this.labelModule); |
|
|
break; |
|
|
break; |
|
|
case 'image': |
|
|
case 'image': |
|
|
this.shape = new Image(this.options, this.body, this.labelModule, this.imageObj); |
|
|
|
|
|
|
|
|
this.shape = new Image(this.options, this.body, this.labelModule, this.imageObj, this.imageObjAlt); |
|
|
break; |
|
|
break; |
|
|
case 'square': |
|
|
case 'square': |
|
|
this.shape = new Square(this.options, this.body, this.labelModule); |
|
|
this.shape = new Square(this.options, this.body, this.labelModule); |
|
|
|