SVG is a Document Object Model much like HTML, therefore all of AngularJS’ directives that aren’t designed to work with specific HTML elements will work on SVG elements as well.
I tried to place some elements for blind control … Up, Stop, Down…
However the whole SVG is too crowded and I would rather use a Slider for this.
Can a slider be used in the SVG?
Thanks!
Current:
Would like to:
maybe a slider like this… which could replace the “window” itself and could control the blind and the same time show the current %state
This is just plain awesome! I have a question about having an item react to an update from OpenHAB. For example, I have door sensors on all exterior doors, is there a way that I can make the object for my doors fill red when the door is opened?
I created a “ng-class” attribute for:
When I open the door, the panel does not change… I did not create an ng-click for a send command, because I don’t want to be able to click on the door and turn the sensor on, I would prefer it to react from an update from the device itself. Is this possible?
@jsable This is perfectly possible and your css and ng-class looks good already.
Maybe, you have a svg group selected instead of only one specific element?! If so, then you can simply assign ng-class to all of the grouped elements and it should work.
Thanks for the encouragement! I figured it out, forgot I had a translation set, so the ‘ON’ didn’t work for me, had to change it to ‘is Open’ and they all started glowing red like I wanted!
itemState(itemname, [ignoreTransform]): retrieves the state of an item by its name;
ignoreTransform (optional, false by default) will return the raw state (e.g. ‘CLOSED’) instead of the transformed state (‘zu’)
So if you have transformations you can explicitely ignore them: itemState('ContactOfficeDoor', true) == 'ON'
(note the “true” as 2nd argument)
I’m a little stuck and I’m hoping you can point out what mistake I’m making. I created the .css file just as shown above and I created a really simple file:
Can you show the code you put in the template widget? Is there an error something showing in the developer tools console? (F12, Console tab, refresh the page)
Well, I don’t know what to say, I initially had the same problem as you with the SVG you provided.
So I loaded it in my Inkscape, removed the “metadata” node by clicking on it and pressing the button in the XML editor, and it gave me this, which works:
Note how it removed the svg: namespace prefixes in elements and added it as the default namespace (xmlns="http://www.w3.org/2000/svg"). I have an older Inkscape version than you but I don’t think it matters. Very odd.
Another thing: do not use double quotes in attribute values as it will apparently replace them by " and that won’t work. See "light-on" which I replaced by 'light-on'.
I just followed the same steps you did and it fixed the issue here too. There may have been a change in the way the Inkscape application handles the SVG generation. I followed your steps above exactly and that’s the file it generated for me. So my guess is there’s something in the way the SVG is being generated by the program, maybe something in the way they handle the metadata.
I don’t know but deleting the metadata fixed the issue.
Thank you
No, I did any creative work like floorplan painting, text and font design etc. in Affinity Designer (I am a big fan of that tool!).
Exported as SVG. Any additional work and duplicating buttons and texts is done in Inkscape (which is not so funny at least on the Mac)
This is all awesome and I’ve already created some genius stuff. Now, I’m facing a problem and maybe you have an idea what is wrong…
To indicate an open door I’d like to change the color (which works) then adjust the X,Y position (which works), and then rotate it by 45 degree… which doesn’t work.
I attached a ng-class attribute to the door object
.tuer-balkon-offen {
fill:#ff0000 !important;
x:-105 !important;
y:225 !important;
transform:rotate(-45.0) !important; <---- what is wrong here?
}
Do you know why “transform:rotate” doesn’t work? … all other attributes are fine. I tried different formats as well like this one…: transform=“rotate(-45)”
I have follow this great tutorial to make my own floorplan. It works great on computer displaying fullscreen 1920x1080 size floorplan. But on android tablet and cell phone, the svg was displayed 2-3 times larger. (I am sure my tablet and phones were 1920x1080 screens). How can I make it adapt to android browsers? Is there something im missing?
it works in general! So many thanks for the first hint.
However, the challenge is now that the object does not rotate around “top right”, but around 0,0 point of the SVG canvas.
So “transform-origin” seems not to work
Thanks
Pirx