|
|
@ -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) { |
|
|
|