Browse Source

fixed #859. images now resize again when they are loaded.

flowchartTest
Alex de Mulder 9 years ago
parent
commit
87277e5db6
2 changed files with 837 additions and 805 deletions
  1. +819
    -803
      dist/vis.js
  2. +18
    -2
      lib/network/modules/components/nodes/util/CircleImageBase.js

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


+ 18
- 2
lib/network/modules/components/nodes/util/CircleImageBase.js View File

@ -4,12 +4,27 @@ class CircleImageBase extends NodeBase {
constructor(options, body, labelModule) {
super(options, body, labelModule);
this.labelOffset = 0;
this.imageLoaded = false;
}
/**
* This function resizes the image by the options size when the image has not yet loaded. If the image has loaded, we
* force the update of the size again.
*
* @private
*/
_resizeImage() {
if (!this.width || !this.height) { // undefined or 0
var width, height, ratio;
let force = false;
if (!this.imageObj.width || !this.imageObj.height) { // undefined or 0
this.imageLoaded = false;
}
else if (this.imageLoaded === false) {
this.imageLoaded = true;
force = true;
}
if (!this.width || !this.height || force === true) { // undefined or 0
var width, height, ratio;
if (this.imageObj.width && this.imageObj.height) { // not undefined or 0
width = 0;
height = 0;
@ -33,6 +48,7 @@ class CircleImageBase extends NodeBase {
this.height = height;
this.radius = 0.5*this.width;
}
}
_drawRawCircle(ctx, x, y, selected, hover, size) {

Loading…
Cancel
Save