Disable network graph emphasis on mobile

This commit is contained in:
Petar Petrov 2025-07-08 08:33:16 +03:00
parent 2e8203f666
commit a06d51f093
2 changed files with 9 additions and 3 deletions

View File

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

View File

@ -226,6 +226,7 @@ export class ZHANetworkVisualizationPage extends LitElement {
: offlineColor,
},
polarDistance: category === 0 ? 0 : category === 1 ? 0.5 : 0.9,
fixed: isCoordinator,
});
// Create links (edges)