Browse Source

- Stopped infinite loop when brokenImage is also not available.

v3_develop
Alex de Mulder 9 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! - Community fix for SVG images in IE11, thanks @dponch!
- Fixed repeating stabilized event when the network is already stabilized. - Fixed repeating stabilized event when the network is already stabilized.
- Added circularImages, thanks for the contribution @brendon1982! - Added circularImages, thanks for the contribution @brendon1982!
- Stopped infinite loop when brokenImage is also not available.
### Graph2d ### 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() { function Images() {
this.images = {}; this.images = {};
this.imageBroken = {};
this.callback = undefined; this.callback = undefined;
} }
@ -23,13 +24,12 @@ Images.prototype.setOnloadCallback = function(callback) {
* @return {Image} img The image object * @return {Image} img The image object
*/ */
Images.prototype.load = function(url, brokenUrl) { Images.prototype.load = function(url, brokenUrl) {
var img = this.images[url];
var img = this.images[url]; // make a pointer
if (img === undefined) { if (img === undefined) {
// create the image // create the image
var me = this; var me = this;
img = new Image(); img = new Image();
img.onload = function () { img.onload = function () {
// IE11 fix -- thanks dponch! // IE11 fix -- thanks dponch!
if (this.width == 0) { if (this.width == 0) {
document.body.appendChild(this); document.body.appendChild(this);
@ -52,8 +52,16 @@ Images.prototype.load = function(url, brokenUrl) {
me.callback(this); 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 { else {
this.src = brokenUrl; this.src = brokenUrl;
me.imageBroken[url] = true;
} }
}; };

Loading…
Cancel
Save