Skip to content

Commit

Permalink
improve display of foreign elements
Browse files Browse the repository at this point in the history
  • Loading branch information
molikk committed Jan 2, 2025
1 parent d8a776e commit 943ed5a
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions src/cards/compact/loadUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ export class LoadUtils {
static getIconWithCondition(condition: boolean, x: number, y: number, icon: string, style_class: string, size = 30) {
return svg`
<g display="${condition ? '' : 'none'}">
<foreignObject x="${x}" y="${y}" width="${size}" height="${size}" style="position: fixed; ">
<body xmlns="http://www.w3.org/1999/xhtml">
<div style="position: fixed; ">
<foreignObject x="${x}" y="${y}" width="${size}" height="${size}">
<div xmlns="http://www.w3.org/1999/xhtml" style="position: fixed; width: ${size}px; height: ${size}px;">
<ha-icon icon="${icon}" class="${style_class}"></ha-icon>
</div>
</body>
</foreignObject>
</g>`;
}
Expand All @@ -27,12 +25,10 @@ export class LoadUtils {
static getIconWithStyleAndCondition(condition: boolean, x: number, y: number, icon: string, color: string, size = 30, icon_size = 20) {
return svg`
<g display="${condition ? '' : 'none'}">
<foreignObject x="${x}" y="${y}" width="${size}" height="${size}" style="position: fixed; ">
<body xmlns="http://www.w3.org/1999/xhtml">
<div style="position: fixed; ">
<foreignObject x="${x}" y="${y}" width="${size}" height="${size}">
<div xmlns="http://www.w3.org/1999/xhtml" style="position: fixed; width: ${size}px; height: ${size}px;">
<ha-icon icon="${icon}" style="color: ${color} !important; --mdc-icon-size: ${icon_size}px;"></ha-icon>
</div>
</body>
</foreignObject>
</g>`;
}
Expand Down

0 comments on commit 943ed5a

Please sign in to comment.