Hi folks,
Unfortunately I still didn't have time yet to use my node-red-contrib-ui-svg node myself
How stupid is that ...
So would be nice to get some feedback from users that have used it already.
More specifically about the size of the SVG compared to the widget size.
-
I specify some size of the dashboard widget:
General question: I give it a long size in the X-direction, to fit nicely on a horizontal placed tablet. However on a smartphone it should be longer in the Y-direction I assume. How can I deal with that?
-
Now I assumed that I have to have the SVG fit that parent widget container:
However that 'might' be difficult to draw (with percentages). Perhaps it easier to have a fixed size, and then use the preserveAspectRatio to define how it needs to be stretched in both directions. I have seen some examples from other users who use an SVG element with the same pixel size as the background image:
<svg preserveAspectRatio="none" x="0" y="0" viewBox="0 0 1704 695" width="100%"> <image width="1704px" height="695" id="background"...
Not sure which way is the most optimal?
Here is an simple flow (for anybody who wants to experiment) that shows a 900x550px image in an svg (with orange blackground):
[{"id":"2399b014.7c6ad","type":"ui_svg_graphics","z":"4ae15451.7b2f5c","group":"2df28529.6748aa","order":2,"width":"12","height":"11","svgString":"<svg width=\"100%\" height=\"100%\" \n xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\"> \n <rect width=\"100%\" height=\"100%\" fill=\"orange\"/>\n <image href=\"https://www.securitymagazine.com/ext/resources/SEC/2016/0216/SEC0216-edu-feature-slide1_900px.jpg\" height=\"100%\" width=\"100%\" preserveAspectRatio=\"xMidYMid meet\"/>\n</svg>","clickableShapes":[],"smilAnimations":[],"bindings":[],"showCoordinates":false,"autoFormatAfterEdit":false,"showBrowserErrors":false,"selectorAsElementId":true,"outputField":"payload","editorUrl":"http://drawsvg.org/drawsvg.html","directory":"","panEnabled":false,"zoomEnabled":false,"controlIconsEnabled":false,"dblClickZoomEnabled":false,"mouseWheelZoomEnabled":false,"name":"","x":520,"y":580,"wires":[[]]},{"id":"2df28529.6748aa","type":"ui_group","z":"","name":"Default","tab":"70e1bf49.ae7ee","order":1,"disp":true,"width":"12","collapse":false},{"id":"70e1bf49.ae7ee","type":"ui_tab","z":"","name":"Background test","icon":"dashboard","disabled":false,"hidden":false}]
All tips are very welcome!
Bart