This message was deleted.
# help
s
This message was deleted.
f
It's probably because d3-annotation expects the svg node to be attached to the DOM (e.g. to measure it with elem.getBBox()). But it is not attached before you return it
p
yeah.. i was afraid it was something like that.
which means it won't work as a mark 😞 w/o a lot of rewriting of d3-annotation. or... a setTimeout? Will try that first, but it is a really hacky way of doing it.
It worked with setTimout but it is ugly. Is there a lifecycle event I can hook into in observable plot to know if it has rendered? kind of like tick in Svelte, useEffect in React or ready in jQuery?
f
requestAnimationFrame? Lifecycle events for DOM elements are only available on custom elements, unfortunately.
p
Just tried it out and it is nicer than my initial setTimeout idea 🙂
f
If you need to check whether a node / element has been inserted into the document you can query Node.isConnected.
p
Cool! Never seen that before. Will have a look.