Disable network graph emphasis on mobile (#26106)

This commit is contained in:
Petar Petrov 2025-07-18 15:04:22 +03:00 committed by GitHub
parent 539884295b
commit 51b79b33fb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -106,14 +106,18 @@ export class HaNetworkGraph extends SubscribeMixin(LitElement) {
if (!GraphChart) { if (!GraphChart) {
return nothing; return nothing;
} }
const isMobile = window.matchMedia(
"all and (max-width: 450px), all and (max-height: 500px)"
).matches;
return html`<ha-chart-base return html`<ha-chart-base
.hass=${this.hass} .hass=${this.hass}
.data=${this._getSeries( .data=${this._getSeries(
this.data, this.data,
this._physicsEnabled, this._physicsEnabled,
this._reducedMotion, this._reducedMotion,
this._showLabels this._showLabels,
) as GraphSeriesOption} isMobile
)}
.options=${this._createOptions(this.data?.categories)} .options=${this._createOptions(this.data?.categories)}
height="100%" height="100%"
.extraComponents=${[GraphChart]} .extraComponents=${[GraphChart]}
@ -168,7 +172,8 @@ export class HaNetworkGraph extends SubscribeMixin(LitElement) {
data: NetworkData, data: NetworkData,
physicsEnabled: boolean, physicsEnabled: boolean,
reducedMotion: boolean, reducedMotion: boolean,
showLabels: boolean showLabels: boolean,
isMobile: boolean
) => { ) => {
const containerWidth = this.clientWidth; const containerWidth = this.clientWidth;
const containerHeight = this.clientHeight; const containerHeight = this.clientHeight;
@ -184,7 +189,7 @@ export class HaNetworkGraph extends SubscribeMixin(LitElement) {
position: "right", position: "right",
}, },
emphasis: { emphasis: {
focus: "adjacency", focus: isMobile ? "none" : "adjacency",
}, },
force: { force: {
repulsion: [400, 600], repulsion: [400, 600],