Browse Source

- Stopped infinite loop when brokenImage is also not available.

v3_develop
Alex de Mulder 10 years ago
parent
commit
49776a2f39
3 changed files with 26731 additions and 26714 deletions
  1. +1
    -0
      HISTORY.md
  2. +26720
    -26712
      dist/vis.js
  3. +10
    -2
      lib/network/Images.js

+ 1
- 0
HISTORY.md View File

@ -54,6 +54,7 @@ http://visjs.org
- Community fix for SVG images in IE11, thanks @dponch!
- Fixed repeating stabilized event when the network is already stabilized.
- Added circularImages, thanks for the contribution @brendon1982!
- Stopped infinite loop when brokenImage is also not available.
### Graph2d

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


+ 10
- 2
lib/network/Images.js View File

@ -4,6 +4,7 @@
*/
function Images() {
this.images = {};
this.imageBroken = {};
this.callback = undefined;
}
@ -23,13 +24,12 @@ Images.prototype.setOnloadCallback = function(callback) {
* @return {Image} img The image object
*/
Images.prototype.load = function(url, brokenUrl) {
var img = this.images[url];
var img = this.images[url]; // make a pointer
if (img === undefined) {
// create the image
var me = this;
img = new Image();
img.onload = function () {
// IE11 fix -- thanks dponch!
if (this.width == 0) {
document.body.appendChild(this);
@ -52,8 +52,16 @@ Images.prototype.load = function(url, brokenUrl) {
me.callback(this);
}
}
else if (me.imageBroken[url] === true) {
console.error("Could not load brokenImage:", brokenUrl);
delete this.src;
if (me.callback) {
me.callback(this);
}
}
else {
this.src = brokenUrl;
me.imageBroken[url] = true;
}
};

Loading…
Cancel
Save