From b9838e47da27664d6efb27f32cdd42ccb9761c1c Mon Sep 17 00:00:00 2001 From: Hundraw Date: Thu, 9 Feb 2023 17:29:51 +0100 Subject: [PATCH] Fix the size of icons in linkable-button --- src/draw/DefaultDrawer.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/draw/DefaultDrawer.js b/src/draw/DefaultDrawer.js index 04f5b2be..92e70c4a 100644 --- a/src/draw/DefaultDrawer.js +++ b/src/draw/DefaultDrawer.js @@ -1334,7 +1334,14 @@ class DefaultDrawer { .attr('y', buttonPadding) .attr('width', iconSize) .attr('height', iconSize) - .attr('viewBox', '0 0 32 32') + // eslint-disable-next-line prefer-arrow-callback + .attr('viewBox', function setViewbox() { + const icon = d3.select(this).select('svg'); + const width = icon.attr('width').replace('px', ''); + const height = icon.attr('height').replace('px', ''); + + return `0 0 ${width} ${height}`; + }) .attr('background-color', 'white'); buttons