Replies: 0 comments 8 replies
-
hey, quick question, why does it need to be a background? |
Beta Was this translation helpful? Give feedback.
-
Hey @jimgoo, I'm trying to do something similar (have TLDraw on top of text) so your project is a confirmation that it is possible 🚀
Do you mind if I ask how did you implement that (from functionality perspective, not the actual implementation details)? When do you switch the z-index of the TLDraw canvas to allow interacting with the Notebook's content? I want to have both things being interactive (the text and the TLDraw canvas), since I would like to support doing stuff with the text (like copy) so I'm not fully convinced about making the user explicitly switch between drawing mode and interaction with text. Maybe putting the text inside the TLDraw canvas is the way to go for my case. |
Beta Was this translation helpful? Give feedback.
-
I do something similar to this with my app here: Except TLDraw is overlayed on top of HTML video. If you're interested in my implementation, you can view it here: https://github.com/Rodeoclash/vodon-player/blob/main/player/src/components/ui/Drawing.tsx This also handles resizing of the screen (and will resize TLDraw to scale with it). |
Beta Was this translation helpful? Give feedback.
-
I've got a use case where I'm trying to overlay TLDraw on top of an HTML background page. The HTML comes from a Jupyter notebook (for example: https://nbviewer.org/github/waltherg/notebooks/blob/master/2013-12-03-Crank_Nicolson.ipynb), so the HTML can contain tables, plots, equations, etc. The idea is to put TLDraw on top of the rendered notebook's HTML that so that scientist type of folks can collaborate on annotating their work in multiplayer mode. The key requirement is that the annotation shapes line up to the same locations in the underlying HTML content across mobile and desktop browsers (so if one person circles a point in a plot, everyone sees the same point circled - see screenshot).
I've got a semi-working version where I do the following:
so that the Tldraw canvas div is set to be a fixed size for all users (
dimensions.width
xdimensions.height
) that is also as large as my notebook HTML. In my fork of Tldraw, I've turned off scroll listeners and zooming so that scrolling just moves down the HTML page. The canvas is essentially finite and spans the bounds of the notebook's HTML.The issue with this approach is that the TLDraw shape coordinates only match up between users if they're using the same type of browser. In the attached screenshot, the Chrome user is on the left drawing in blue, and the Safari user is on the right drawing in red. I think this is just due to subtle differences in how the browsers render the HTML, which throws off the locations of TLdraw things since the coordinates are all with respect to a
dimensions.width
xdimensions.height
canvas. The differences increase as we go further down the page and tiny differences compound.There's no real issue with TLDraw, my question is more how can I go about this in a better way? I've considered moving
<NotebookHTML>
to inside of the TLDraw canvas, but I don't think that would solve the differences in browser rendering issue.For mobile users, the differences are even worse since I think the browser HTML rendering differences compound even more. I've also tried adding a huge screenshot of the HTML page to TLDraw as media, but the font looks super tiny and it just feel kind of unwieldily. I have no way of getting pure SVG of the notebook, plus the users have some javascript embedded in the notebook HTML for hovering over points in a plot, etc.
Is there a better way to do what I'm trying to do? Again, I have no issues with TLDraw at all. It's been wonderful to work with and learn from.
Beta Was this translation helpful? Give feedback.
All reactions