-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] 'floorplan.text_set' should support element which has text as child #358
Comments
I sencond that as I have the same problem: attribes of child (e.g. tsdpan) of text nodes are erased |
That's a fair input. I'll fix it whenever possible. I thought @pkozul looked into it. PR's also much appreciated, if they're tested. Else,I'll try and prioritize it as soon as possible. |
Before fix: <svg height="100%" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink" style="height: 100%; width: 100%; margin: auto; cursor: default; opacity: 1; display: block;">
<g id="temperature.kitchen"><tspan>21.42</tspan></g>
</svg> After fix: <svg height="100%" width="100%" xmlns:xlink="http://www.w3.org/1999/xlink" style="height: 100%; width: 100%; margin: auto; cursor: default; opacity: 1; display: block;">
<g id="temperature.kitchen" class="floorplan-hover" style="cursor: pointer;">
<text><tspan x="5" y="5">21.42</tspan></text>
<title>...(removed)...</title></g>
</svg> Branch: https://github.com/ExperienceLovelace/ha-floorplan/tree/bug/text_set_use_existing_tspan I have also added the logics to save the x and y, if it's a single tspan. I don't know why I didn't think of that while implementing the other feature. |
…ting_tspan Bug/text set use existing tspan - fixes #358
Kindly check with: https://github.com/ExperienceLovelace/ha-floorplan/blob/dev/dist/floorplan.js It's currently in the dev-branch. |
Description
Prior to version 1.0.36 setText would look for any existing
tspan
children and change the child text.From version 1.0.36 with new line feature setText will presume that entity is a
text
node and appendtspan
with the text to that node.This does not work if you use
floorplan.text_set
on a entity that is ag
node, for example.Current experience
Original SVG
YAML
Produced SVG
Expected SVG
Suggestion
Update
setText
to look for childtext
node if element is notSVGTextElement
.The text was updated successfully, but these errors were encountered: