|
Post by rikky on Apr 17, 2021 13:27:04 GMT 1
Hello Gui making is not my thing. But I succeeded in making an svg image with a few buttons. Yet now I have a position on a chart that I want to center in the middle. Seems easy. The x viewbox coordinate is the x position minus half the viewbox width. idem for the y So I have a position 380 369 and a viewbox width and hight of both 484 viewbox x becomes 380 - 242 = 138 viewbox y becomes 369 - 242 = 127 My svg to center position 380 369 then becomes : <svg width='768' height='768' viewBox='138 127 484 484' What's more, if I view this picture with my default viewer (gpicview) then indeed, the position is exactly in the middle. However with the most simple svg viewer that I could filter out of the GUI proxy for BaCon, I get it all wrong. So included the viewer and the chart.svg The chart is rather big, and I have understood that ther is not a lot of space left on the BaCon forum, so I'll remove it in a few days. Rik.
|
|
|
Post by Pjot on Apr 18, 2021 20:42:42 GMT 1
Hi rikky, Actually, I am not sure what the problem is you're trying to describe? As this question mostly seems to be related to SVG, you probably may better head to a SVG support forum... Having said that, for me it seems to work fine both for "svg width='768' height='768' viewBox='0 0 768 768'" and also "width='768' height='768' viewBox='138 127 484 484" (see attached screenshots). BR Peter Attachments:
|
|
|
Post by rikky on Apr 18, 2021 22:09:07 GMT 1
Actually I just figured it out. The width and height of the svg have to fit in the width and height_request of the window. So the svg becomes : <svg width='500' height='500' etc And contrary to what you would instinctively think, you can make this size littler than the actual image or whatever that is inside (even another svg that is bigger) like <svg width='500' height='500' viewBox='188 177 384 384' etc > <g> <image x='0' y='0' width='800' height='800' etc> etc </g> </svg> The aim was to get the black circle in the middle. Which it now does. Thanks. Rik.
|
|