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) { 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,
isMobile
)} )}
.options=${this._createOptions(this.data?.categories)} .options=${this._createOptions(this.data?.categories)}
height="100%" height="100%"
@ -176,7 +180,8 @@ export class HaNetworkGraph extends 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;
@ -193,7 +198,7 @@ export class HaNetworkGraph extends LitElement {
position: "right", position: "right",
}, },
emphasis: { emphasis: {
focus: "adjacency", focus: isMobile ? "none" : "adjacency",
}, },
force: { force: {
repulsion: [400, 600], repulsion: [400, 600],

View File

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