From a5d868f694df0ef4e5fb6442503d911b8bbe5dcd Mon Sep 17 00:00:00 2001 From: Mononaut Date: Mon, 6 Oct 2025 09:03:14 +0000 Subject: [PATCH] center custom dashboard image --- .../address-graph/address-graph.component.ts | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/frontend/src/app/components/address-graph/address-graph.component.ts b/frontend/src/app/components/address-graph/address-graph.component.ts index 1affc92c9..e4eb4dbf1 100644 --- a/frontend/src/app/components/address-graph/address-graph.component.ts +++ b/frontend/src/app/components/address-graph/address-graph.component.ts @@ -512,38 +512,48 @@ export class AddressGraphComponent implements OnChanges, OnDestroy { } graphicElements() { - const graphicElements = []; - - if (this.label) { - graphicElements.push({ - type: 'text', - right: this.adjustedRight + 22 + 'px', - bottom: '36px', - z: 100, - silent: true, - style: { - fill: '#fff', - text: this.label, - font: '24px sans-serif' - } - }); - } + const children = []; if (this.image) { - graphicElements.push({ + children.push({ type: 'image', style: { image: this.image, width: 120, height: 80, }, - right: this.adjustedRight + 22, - bottom: this.label ? 66 : 36, + left: 'center', + top: 0, z: 100, - silent: true, }); } - return graphicElements; + if (this.label) { + children.push({ + type: 'text', + left: 'center', + top: this.image ? 90 : 0, + z: 100, + style: { + fill: '#fff', + text: this.label, + font: '24px sans-serif', + textAlign: 'center' + } + }); + } + + if (children.length) { + return [{ + type: 'group', + right: this.adjustedRight + 22, + bottom: '36px', + z: 100, + silent: true, + children: children + }]; + } else { + return []; + } } }