Browse Source

Fixed icon placement in Value stepper icon

pull/15489/head
Maksym Tsymbarov 5 months ago
parent
commit
85356c291c
  1. 12
      ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.models.ts

12
ui-ngx/src/app/modules/home/components/widget/lib/rpc/power-button-widget.models.ts

@ -28,7 +28,7 @@ import { Circle, Effect, Element, G, Gradient, Path, Runner, Svg, Text, Timeline
import '@svgdotjs/svg.filter.js'; import '@svgdotjs/svg.filter.js';
import tinycolor from 'tinycolor2'; import tinycolor from 'tinycolor2';
import { WidgetContext } from '@home/models/widget-component.models'; import { WidgetContext } from '@home/models/widget-component.models';
import { Observable, of, shareReplay } from 'rxjs'; import { from, Observable, of, shareReplay } from 'rxjs';
import { isSvgIcon, splitIconName } from '@shared/models/icon.models'; import { isSvgIcon, splitIconName } from '@shared/models/icon.models';
import { catchError, map, take } from 'rxjs/operators'; import { catchError, map, take } from 'rxjs/operators';
import { MatIconRegistry } from '@angular/material/icon'; import { MatIconRegistry } from '@angular/material/icon';
@ -392,7 +392,15 @@ export abstract class PowerButtonShape {
tspan.attr({ tspan.attr({
'dominant-baseline': 'hanging' 'dominant-baseline': 'hanging'
}); });
return of(textElement); return from(document.fonts.ready).pipe(
map(() => {
const iconGroup = this.svgShape.group();
textElement.addTo(iconGroup);
const box = iconGroup.bbox();
iconGroup.translate(-box.cx, -box.cy);
return iconGroup;
})
);
} }
} }

Loading…
Cancel
Save