|
@ -141,21 +141,7 @@ class Node { |
|
|
|
|
|
|
|
|
this.choosify(options); |
|
|
this.choosify(options); |
|
|
|
|
|
|
|
|
// load the images
|
|
|
|
|
|
if (this.options.image !== undefined) { |
|
|
|
|
|
if (this.imagelist) { |
|
|
|
|
|
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 { |
|
|
|
|
|
throw "No imagelist provided"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
this._load_images(); |
|
|
this.updateLabelModule(options); |
|
|
this.updateLabelModule(options); |
|
|
this.updateShape(currentShape); |
|
|
this.updateShape(currentShape); |
|
|
this.labelModule.propagateFonts(this.nodeOptions, options, this.defaultOptions); |
|
|
this.labelModule.propagateFonts(this.nodeOptions, options, this.defaultOptions); |
|
@ -167,6 +153,46 @@ class Node { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Load the images from the options, for the nodes that need them. |
|
|
|
|
|
* |
|
|
|
|
|
* TODO: The imageObj members should be moved to CircularImageBase. |
|
|
|
|
|
* It's the only place where they are required. |
|
|
|
|
|
* |
|
|
|
|
|
* @private |
|
|
|
|
|
*/ |
|
|
|
|
|
_load_images() { |
|
|
|
|
|
// Don't bother loading for nodes without images
|
|
|
|
|
|
if (this.options.shape !== 'circularImage' && this.options.shape !== 'image') { |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.options.image === undefined) { |
|
|
|
|
|
throw "Option image must be defined for node type '" + this.options.shape + "'"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (this.imagelist === undefined) { |
|
|
|
|
|
throw "Internal Error: No images provided"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (typeof this.options.image === 'string') { |
|
|
|
|
|
this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id); |
|
|
|
|
|
} else { |
|
|
|
|
|
if (this.options.image.unselected === undefined) { |
|
|
|
|
|
throw "No unselected image provided"; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
this.imageObj = this.imagelist.load(this.options.image.unselected, this.options.brokenImage, this.id); |
|
|
|
|
|
|
|
|
|
|
|
if (this.options.image.selected !== undefined) { |
|
|
|
|
|
this.imageObjAlt = this.imagelist.load(this.options.image.selected, this.options.brokenImage, this.id); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.imageObjAlt = undefined; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined. |
|
|
* This process all possible shorthands in the new options and makes sure that the parentOptions are fully defined. |
|
|
* Static so it can also be used by the handler. |
|
|
* Static so it can also be used by the handler. |
|
|