diff --git a/src/components/ha-gauge.ts b/src/components/ha-gauge.ts index 9ce1259669..c3374d6b97 100644 --- a/src/components/ha-gauge.ts +++ b/src/components/ha-gauge.ts @@ -1,16 +1,10 @@ import { css, LitElement, PropertyValues, svg, TemplateResult } from "lit"; import { customElement, property, state } from "lit/decorators"; -import { ifDefined } from "lit/directives/if-defined"; import { styleMap } from "lit/directives/style-map"; import { formatNumber } from "../common/number/format_number"; import { afterNextRender } from "../common/util/render-status"; import { FrontendLocaleData } from "../data/translation"; import { getValueInPercentage, normalize } from "../util/calculate"; -import { isSafari } from "../util/is_safari"; - -// Safari version 15.2 and up behaves differently than other Safari versions. -// https://github.com/home-assistant/frontend/issues/10766 -const isSafari152 = isSafari && /Version\/15\.[^0-1]/.test(navigator.userAgent); const getAngle = (value: number, min: number, max: number) => { const percentage = getValueInPercentage(normalize(value, min, max), min, max); @@ -65,12 +59,12 @@ export class Gauge extends LitElement { protected render() { return svg` - + ${ !this.needle || !this.levels ? svg`` : "" } @@ -87,9 +81,9 @@ export class Gauge extends LitElement { stroke="var(--info-color)" class="level" d="M - ${50 - 40 * Math.cos((angle * Math.PI) / 180)} - ${50 - 40 * Math.sin((angle * Math.PI) / 180)} - A 40 40 0 0 1 90 50 + ${0 - 40 * Math.cos((angle * Math.PI) / 180)} + ${0 - 40 * Math.sin((angle * Math.PI) / 180)} + A 40 40 0 0 1 40 0 " >`; } @@ -98,9 +92,9 @@ export class Gauge extends LitElement { stroke="${level.stroke}" class="level" d="M - ${50 - 40 * Math.cos((angle * Math.PI) / 180)} - ${50 - 40 * Math.sin((angle * Math.PI) / 180)} - A 40 40 0 0 1 90 50 + ${0 - 40 * Math.cos((angle * Math.PI) / 180)} + ${0 - 40 * Math.sin((angle * Math.PI) / 180)} + A 40 40 0 0 1 40 0 " >`; }) @@ -110,46 +104,16 @@ export class Gauge extends LitElement { this.needle ? svg` ` : svg`` } - ${ - // Workaround for https://github.com/home-assistant/frontend/issues/6467 - isSafari - ? svg`` - : "" - } @@ -187,12 +151,10 @@ export class Gauge extends LitElement { fill: none; stroke-width: 15; stroke: var(--gauge-color); - transform-origin: 50% 100%; transition: all 1s ease 0s; } .needle { fill: var(--primary-text-color); - transform-origin: 50% 100%; transition: all 1s ease 0s; } .level {