diff --git a/HISTORY.md b/HISTORY.md index 2d2918c3..b8900a6b 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -17,6 +17,7 @@ http://visjs.org - Fixed #1111, check if edges exist was not correct on update. - Fixed #1112, network now works in firefox on unix again. - Added #931, borderRadius in shapeProperties for the box shape. +- Added #936, useImageSize for images and circularImages ## 2015-07-20, version 4.5.1 diff --git a/dist/vis.js b/dist/vis.js index 42aa6738..69d1612c 100644 --- a/dist/vis.js +++ b/dist/vis.js @@ -27244,7 +27244,8 @@ return /******/ (function(modules) { // webpackBootstrap shape: 'ellipse', shapeProperties: { borderDashes: false, - borderRadius: 6 + borderRadius: 6, + useImageSize: false }, size: 25, title: undefined, @@ -28811,19 +28812,25 @@ return /******/ (function(modules) { // webpackBootstrap width = 0; height = 0; } - if (this.imageObj.width > this.imageObj.height) { - ratio = this.imageObj.width / this.imageObj.height; - width = this.options.size * 2 * ratio || this.imageObj.width; - height = this.options.size * 2 || this.imageObj.height; - } else { - if (this.imageObj.width && this.imageObj.height) { - // not undefined or 0 - ratio = this.imageObj.height / this.imageObj.width; + if (this.options.shapeProperties.useImageSize === false) { + if (this.imageObj.width > this.imageObj.height) { + ratio = this.imageObj.width / this.imageObj.height; + width = this.options.size * 2 * ratio || this.imageObj.width; + height = this.options.size * 2 || this.imageObj.height; } else { - ratio = 1; + if (this.imageObj.width && this.imageObj.height) { + // not undefined or 0 + ratio = this.imageObj.height / this.imageObj.width; + } else { + ratio = 1; + } + width = this.options.size * 2; + height = this.options.size * 2 * ratio; } - width = this.options.size * 2 || this.imageObj.width; - height = this.options.size * 2 * ratio || this.imageObj.height; + } else { + // when not using the size property, we use the image size + width = this.imageObj.width; + height = this.imageObj.height; } this.width = width; this.height = height; @@ -39907,6 +39914,7 @@ return /******/ (function(modules) { // webpackBootstrap shapeProperties: { borderDashes: { boolean: boolean, array: array }, borderRadius: { number: number }, + useImageSize: { boolean: boolean }, __type__: { object: object } }, size: { number: number }, @@ -40041,8 +40049,9 @@ return /******/ (function(modules) { // webpackBootstrap }, shape: ['ellipse', 'box', 'circle', 'database', 'diamond', 'dot', 'square', 'star', 'text', 'triangle', 'triangleDown'], shapeProperties: { - //borderDashes: false, - borderRadius: 6 + borderDashes: false, + borderRadius: 6, + useImageSize: false }, size: [25, 0, 200, 1] }, diff --git a/docs/network/nodes.html b/docs/network/nodes.html index 1b7a638c..83c00b7e 100644 --- a/docs/network/nodes.html +++ b/docs/network/nodes.html @@ -631,7 +631,15 @@ mySize = minSize + diff * scale;
6
box
shape. It allows you to determine the roundness of the corners of the shape.
+ false
image
and circularImage
shapes. When false, the size option is used, when true, the size of the image is used.