diff --git a/HISTORY.md b/HISTORY.md index 6ae704a5..e6e10ee6 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -8,6 +8,9 @@ http://visjs.org - Implemented reordering groups by dragging them vertically. Thanks @hansmaulwurf23. +### Network + +- Fixed #1152, updating images now works. ## 2015-07-27, version 4.7.0 diff --git a/dist/vis.js b/dist/vis.js index 57c42bd4..feb3f802 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -5,7 +5,7 @@ * A dynamic, browser-based visualization library. * * @version 4.7.1-SNAPSHOT - * @date 2015-08-04 + * @date 2015-08-07 * * @license * Copyright (C) 2011-2014 Almende B.V, http://almende.com @@ -28155,7 +28155,7 @@ return /******/ (function(modules) { // webpackBootstrap key: 'updateShape', value: function updateShape(currentShape) { if (currentShape === this.options.shape && this.shape) { - this.shape.setOptions(this.options); + this.shape.setOptions(this.options, this.imageObj); } else { // choose draw method depending on the shape switch (this.options.shape) { @@ -29070,14 +29070,22 @@ return /******/ (function(modules) { // webpackBootstrap 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 - */ - _createClass(CircleImageBase, [{ + key: 'setOptions', + value: function setOptions(options, imageObj) { + this.options = options; + if (imageObj) { + this.imageObj = imageObj; + } + } + + /** + * 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 + */ + }, { key: '_resizeImage', value: function _resizeImage() { var force = false; diff --git a/lib/network/modules/components/Node.js b/lib/network/modules/components/Node.js index 5fb93e2c..2f2b6e8e 100644 --- a/lib/network/modules/components/Node.js +++ b/lib/network/modules/components/Node.js @@ -224,7 +224,7 @@ class Node { updateShape(currentShape) { if (currentShape === this.options.shape && this.shape) { - this.shape.setOptions(this.options); + this.shape.setOptions(this.options, this.imageObj); } else { // choose draw method depending on the shape diff --git a/lib/network/modules/components/nodes/util/CircleImageBase.js b/lib/network/modules/components/nodes/util/CircleImageBase.js index f262b68c..e4d9f803 100644 --- a/lib/network/modules/components/nodes/util/CircleImageBase.js +++ b/lib/network/modules/components/nodes/util/CircleImageBase.js @@ -7,6 +7,13 @@ class CircleImageBase extends NodeBase { this.imageLoaded = false; } + setOptions(options, imageObj) { + this.options = options; + if (imageObj) { + this.imageObj = imageObj; + } + } + /** * 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. diff --git a/test/networkTest.html b/test/networkTest.html index 18daec5e..0454c4c9 100644 --- a/test/networkTest.html +++ b/test/networkTest.html @@ -1,557 +1,58 @@ - - + +
-