No, that wont work, because you can’t have the button that show the page on the same page the button should show. Ok, this is how it works on my example:
All the buttons is on a layer with another id than page0 to page9. Therefor it will always be visible.
page0 is the default page, which is shown when you go to floorplan in the ui, or refresh your browser. page 1-9 is layers you define yourself.
Buttons with id show.toggle will cycle through all the pages.
Buttons with id show.page1, show.page2 etc, will show the specific layer.
If you want your buttons to hide when you click on them, you could move them to page0, then they will disappear and only the specific layer will be shown. You could then have a button on each layer to go back to page0 if you want.
Remember that changing the name of the layer in inkscape (rename layer) does not work, you need to change the id in the xml-editor in inkscape, and set the id for the layer there.
No need. Testet it myself out of curiosity, but didn’t work. It seems to add support to toggle through pages with higher number, but can’t call those specific pages. Meaby someone who knows javascript know what to change.
I will try to find out how to get out of this problem. I need more then 9 pages. If you find a solution please let me know.
I already try with hide/show layers with click (inkscape/object properties/interactivity/onclick). For now I only figured out if I put the line in object properties/interactivity/onclick: style="display:none"
I can hide object when I click on it. But I don’t know how to call it back with some button click.
Ok, you probably know this, but remember that objects that links to entity ID’s can be hidden and displayed through css-code. Like this for my burglar alarm:
I’ve been using this over a few version of floorplan but with the latest Polymer update I can’t seem to get this code to work.
I’ve made the modifications to ha-floorplan.html
and including the custom_js.js. But it seems to have broken this modification entirely. Are you still using this method and have you experienced trouble since this newest update? Since the Polymer update I really don’t have the option of rolling back. Any help would be appreciated.
Apparently there is an icon (MDI) named “svg” that gets in conflit with the jquery selector of < svg > element.
So this means that instead of the whole < svg > object, this “svg” named icon is being passed to the floorplan:loaded function.
And that is not happening on loadFloorPlan(callback) function.
On this line, let svg = $(result).find(‘svg’)[0]; returns the correct object.
By the time it calls $(document).trigger( “floorplan:loaded”, [this, svg]);
some other method is updating and the icon is fetched instead of the object.
Since I can’t figure out where this is happening, I just create a global var and store a copy of svg.
Here is what you need to fix it:
create the global var on the first line within the < script > tag
< script >
//fix for mutilayer floor conflit with mdi icon named SVG
var g_svg= ‘’;
inside loadFloorPlan(callback) function, add the reference to the global var
let svg = $(result).find(‘svg’)[0];
//fix for mutilayer floor conflit with mdi icon named SVG
g_svg = svg;
change the call of loadFloorPlan function to use the global var.
//fix for mutilayer floor conflit with mdi icon named SVG
//$(document).trigger( “floorplan:loaded”, [this, svg]);
$(document).trigger( “floorplan:loaded”, [this, g_svg]);
Remember, this is only a workaround, and should not be considered as update to fix the bug. The correct way should be to figure it out where the fetch is getting the icon and prevent it.