From 162227e196f9e0e592f78f695bdfd3fd82971137 Mon Sep 17 00:00:00 2001 From: Gavin Nishizawa Date: Mon, 23 Jan 2023 20:33:41 -0800 Subject: [PATCH] only add extra x padding for non-special shapes --- d2graph/d2graph.go | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index dc5bd13c8..e675a9670 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -1162,11 +1162,15 @@ func (g *Graph) SetDimensions(mtexts []*d2target.MText, ruler *textmeasure.Ruler paddingX += 20 paddingY += 20 } - if obj.Attributes.Link != "" { - paddingX += 32 - } - if obj.Attributes.Tooltip != "" { - paddingX += 32 + switch shapeType { + case shape.TABLE_TYPE, shape.CLASS_TYPE, shape.CODE_TYPE, shape.IMAGE_TYPE: + default: + if obj.Attributes.Link != "" { + paddingX += 32 + } + if obj.Attributes.Tooltip != "" { + paddingX += 32 + } } if desiredWidth == 0 && desiredHeight == 0 {