Skip to content

Commit

Permalink
update connections
Browse files Browse the repository at this point in the history
  • Loading branch information
SirUlbrich committed Dec 17, 2024
1 parent b60e2fd commit 8cebdb4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 5 additions & 1 deletion dist/custom-energy-card.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/custom-energy-card.js.map

Large diffs are not rendered by default.

16 changes: 15 additions & 1 deletion src/custom-energy-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,18 @@ export class CustomEnergyCard extends LitElement {
<div>☀️ PV1</div>
<div class="state" id="pv1State">${pv1State ? pv1State.state : "N/A"}</div>
<svg width="100%" height="100%" style="position: absolute; top: 0; left: 0; pointer-events: none;">
<polyline id="connection-line-1" points="" stroke="black" stroke-width="2" fill="none" />
<!-- Use writeCircleAndLine to create a connection between Solar and PV1 -->
${this.htmlWriter.writeCircleAndLine(
'generation_to_pv1',
'M' +
(solarPosition.x - this.pxRate + gap) + ',' + solarPosition.y +
'C' +
(solarPosition.x - this.pxRate + gap) + ',' +
(solarPosition.y + gap) + ' ' +
(solarPosition.x - this.pxRate + gap) + ',' +
(solarPosition.y + gap) + ' ' +
pv1Position.x + ',' + (pv1Position.y - gap)
)}
</svg>
</div>`
: null
Expand Down Expand Up @@ -132,6 +143,9 @@ export class CustomEnergyCard extends LitElement {
dy: rect.bottom,
};
}
const solarPosition = getBox(solarBox);
const pv1Position = getBox(pv1Box);
const pv3Position = getBox(pv3Box);
// Get the center of the Solar and PV1 boxes
const solarPol = getBox(solarBox);
const pv1Pol = getBox(pv1Box);
Expand Down

0 comments on commit 8cebdb4

Please sign in to comment.