diff --git a/docs/network/nodes.html b/docs/network/nodes.html
index 6ab0d00691..1bd769934b 100644
--- a/docs/network/nodes.html
+++ b/docs/network/nodes.html
@@ -1113,6 +1113,22 @@
Options
50 |
The size of the icon. |
+
+ | icon.inheritSize |
+ Boolean |
+ false |
+
+ When true, inherit size from
+ node.size. Takes precedence over
+ icon.size. Note: This flag exists to preserve the original behavior of
+ icons. If using groups to set icons, you may want to set this to
+ true
+ so you can drive icon size without overwriting the group icon
+ object.
+
+ |
+
| icon.color |
String |
diff --git a/lib/network/modules/NodesHandler.js b/lib/network/modules/NodesHandler.js
index c948b9fd96..96778938d4 100644
--- a/lib/network/modules/NodesHandler.js
+++ b/lib/network/modules/NodesHandler.js
@@ -85,7 +85,7 @@ class NodesHandler {
icon: {
face: "FontAwesome", //'FontAwesome',
code: undefined, //'\uf007',
- size: 50, //50,
+ size: undefined, //set to 50 in NodeBase to allow inheriting Node.size,
color: "#2B7CE9", //'#aa00ff'
},
image: undefined, // --> URL
@@ -142,7 +142,7 @@ class NodesHandler {
useBorderWithImage: false, // only for image shape
coordinateOrigin: "center", // only for image and circularImage shapes
},
- size: 25,
+ size: undefined, // set to 25 in NodeBase to allow icon to inherit size,
title: undefined,
value: undefined,
x: undefined,
diff --git a/lib/network/modules/components/nodes/util/NodeBase.js b/lib/network/modules/components/nodes/util/NodeBase.js
index 32f2b598a8..48d9021d58 100644
--- a/lib/network/modules/components/nodes/util/NodeBase.js
+++ b/lib/network/modules/components/nodes/util/NodeBase.js
@@ -26,6 +26,14 @@ class NodeBase {
* @param {object} options
*/
setOptions(options) {
+ if (options.icon) {
+ if (options.icon.inheritSize) {
+ options.icon.size = options.size || 50;
+ } else {
+ options.icon.size = options.icon.size || 50;
+ }
+ }
+ options.size = options.size || 25;
this.options = options;
}
diff --git a/lib/network/options.ts b/lib/network/options.ts
index 070de61f49..43d6f3a55f 100644
--- a/lib/network/options.ts
+++ b/lib/network/options.ts
@@ -121,6 +121,7 @@ const nodeOptions: OptionsConfig = {
face: { string },
code: { string }, //'\uf007',
size: { number }, //50,
+ inheritSize: { boolean: bool },
color: { string },
weight: { string, number },
__type__: { object },
diff --git a/types/network/Network.d.ts b/types/network/Network.d.ts
index b9fb2bb7ca..c7b2a0e786 100644
--- a/types/network/Network.d.ts
+++ b/types/network/Network.d.ts
@@ -923,6 +923,7 @@ export interface NodeOptions {
size?: number, // 50,
color?: string,
weight?: number | string,
+ inheritSize?: boolean,
};
image?: string | Image;