From 4259aad3481f76d52a6a4c5320059a820d1c066d Mon Sep 17 00:00:00 2001 From: ziajka Date: Fri, 20 Apr 2018 10:29:10 +0200 Subject: [PATCH] Interface labels - surrounding box when selected --- .../cartography/shared/widgets/interface-label.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/app/cartography/shared/widgets/interface-label.ts b/src/app/cartography/shared/widgets/interface-label.ts index d4f52c9f..50e5d763 100644 --- a/src/app/cartography/shared/widgets/interface-label.ts +++ b/src/app/cartography/shared/widgets/interface-label.ts @@ -6,7 +6,7 @@ import { select } from "d3-selection"; export class InterfaceLabelWidget { - static SURROUNDING_TEXT_BORDER = 10; + static SURROUNDING_TEXT_BORDER = 5; private cssFixer: CssFixer; @@ -91,10 +91,12 @@ export class InterfaceLabelWidget { const text = parent.select('text'); const bbox = text.node().getBBox(); - current.attr('width', bbox.width + InterfaceLabelWidget.SURROUNDING_TEXT_BORDER); - current.attr('height', bbox.height + InterfaceLabelWidget.SURROUNDING_TEXT_BORDER); - current.attr('x', bbox.x - InterfaceLabelWidget.SURROUNDING_TEXT_BORDER); - current.attr('y', bbox.y - InterfaceLabelWidget.SURROUNDING_TEXT_BORDER); + const border = InterfaceLabelWidget.SURROUNDING_TEXT_BORDER; + + current.attr('width', bbox.width + border*2); + current.attr('height', bbox.height + border); + current.attr('x', - border); + current.attr('y', - bbox.height); }); labels