From beef5aaf7c8dc1bc9f3af1b287f8395aae9fd5fb Mon Sep 17 00:00:00 2001 From: jamespcole Date: Tue, 1 Jan 2019 02:34:08 +1100 Subject: [PATCH] feat: added the ability to set the size of an icon when using a dot shape --- lib/network/modules/components/nodes/util/ShapeBase.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/network/modules/components/nodes/util/ShapeBase.js b/lib/network/modules/components/nodes/util/ShapeBase.js index b72dadb23..8c3b2c67d 100644 --- a/lib/network/modules/components/nodes/util/ShapeBase.js +++ b/lib/network/modules/components/nodes/util/ShapeBase.js @@ -52,11 +52,12 @@ class ShapeBase extends NodeBase { this.initContextForDraw(ctx, values); ctx[shape](x, y, values.size); this.performFill(ctx, values); - + if (this.options.icon !== undefined) { if (this.options.icon.code !== undefined) { + var iconScale = (this.options.icon.scale || 0.5); ctx.font = (selected ? "bold " : "") - + (this.height / 2) + "px " + + Math.round(this.height * iconScale) + "px " + (this.options.icon.face || 'FontAwesome'); ctx.fillStyle = this.options.icon.color || "black"; ctx.textAlign = "center";