Hi All,
While waiting for my flight I tried to get an example of a terra going, which inserts a canvas after an element; if I put the div at the beginning, the output overlaps with the following cells. Any ideas how to fix?
Hi All,
While waiting for my flight I tried to get an example of a terra going, which inserts a canvas after an element; if I put the div at the beginning, the output overlaps with the following cells. Any ideas how to fix?
Here you go:
https://beta.observablehq.com/@jashkenas/terra-demo
Terraโs insertAfter
API is a bit awkward in an Observable notebook, because it wants to mutate an external cell.
In this forked version, we say that ex1
is a viewof
, providing both a value
: ex1
and a piece of DOM: the div
containing the canvas element. In this way, ex1
can define itself, without having to mutate an external cell.
Weโve just deployed a new release that uses the new Resize Observer specification where available (which unfortunately is just Chrome for now according to Can I use). Resize Observers make Observable much more robust in detecting when cells resize asynchronously.
Alternatively, you can dispatch an update event to tell Observable explicitly that a cell has resized as shown in the Introduction to HTML notebook.