Browse Source

- Fixed #861, brokenImage only working for one node if nodes have the same image.

flowchartTest
Alex de Mulder 9 years ago
parent
commit
db5782cad8
5 changed files with 1149 additions and 1141 deletions
  1. +1
    -0
      HISTORY.md
  2. +1139
    -1136
      dist/vis.js
  3. +7
    -3
      lib/network/Images.js
  4. +2
    -1
      lib/network/modules/components/Node.js
  5. +0
    -1
      lib/network/modules/components/nodes/util/CircleImageBase.js

+ 1
- 0
HISTORY.md View File

@ -19,6 +19,7 @@ http://visjs.org
- Added multiselect to the docs.
- Removed depricated dynamic entree, allow any smooth curve style for hierarchical layout.
- Fixed bug with the moveTo and getViewPosition methods.
- Fixed #861, brokenImage only working for one node if nodes have the same image.
### Graph2d & Timeline

+ 1139
- 1136
dist/vis.js
File diff suppressed because it is too large
View File


+ 7
- 3
lib/network/Images.js View File

@ -6,6 +6,7 @@ function Images(callback) {
this.images = {};
this.imageBroken = {};
this.callback = callback;
}
/**
@ -14,7 +15,7 @@ function Images(callback) {
* @param {string} url Url of an image to use if the url image is not found
* @return {Image} img The image object
*/
Images.prototype.load = function(url, brokenUrl) {
Images.prototype.load = function(url, brokenUrl, id) {
var img = this.images[url]; // make a pointer
if (img === undefined) {
// create the image
@ -44,7 +45,7 @@ Images.prototype.load = function(url, brokenUrl) {
}
}
else {
if (me.imageBroken[url] === true) {
if (me.imageBroken[id] && me.imageBroken[id][url] === true) {
console.error("Could not load brokenImage:", brokenUrl);
delete this.src;
if (me.callback) {
@ -54,7 +55,10 @@ Images.prototype.load = function(url, brokenUrl) {
else {
console.error("Could not load image:", url);
this.src = brokenUrl;
me.imageBroken[url] = true;
if (me.imageBroken[id] === undefined) {
me.imageBroken[id] = {};
}
me.imageBroken[id][url] = true;
}
}
};

+ 2
- 1
lib/network/modules/components/Node.js View File

@ -140,7 +140,8 @@ class Node {
// load the images
if (this.options.image !== undefined && this.options.image != "") {
if (this.imagelist) {
this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage);
this.imageObj = this.imagelist.load(this.options.image, this.options.brokenImage, this.id);
console.log(this.imagelist)
}
else {
throw "No imagelist provided";

+ 0
- 1
lib/network/modules/components/nodes/util/CircleImageBase.js View File

@ -75,7 +75,6 @@ class CircleImageBase extends NodeBase {
}
_drawImageAtPosition(ctx) {
console.log(this.options.label, this.imageObj.width)
if (this.imageObj.width != 0) {
// draw the image
ctx.globalAlpha = 1.0;

Loading…
Cancel
Save