I just made my first steps with WASM and Seed which was a very smooth experience so far. I was able to create SVG using svg!
, circle!
, text!
, ... and similar macros. To generate my SVG in the proper way, I have to measure text. My idea is to generate SVG text nodes and call getBBox on the node. I figured out that Seed is using web_sys and that getBBox is implemented there.
My problem is how to get from the Node
created by text!
to the SvgTextElement. I tried to access the node_ws
field, but it seems to be "empty". It might not yet been created, but I don't now enough about the Seed internals.
So how do I create a SVG text node so that I can call getBBox on it before generating the "main" SVG nodes?
You can use
el_ref
to get a reference to the DOM element. Something like this ought to work: