An infinite board of live pages
A zoomable, pannable canvas where every tile is a working document: notes you can type in, a to-do list, a spreadsheet, a sketch pad,
and other pages of this site running in iframes. One drawElementImage() per tile under a zoom transform. The text is
re-rasterised at every zoom level, and clicks, focus and typing go to the elements.
Show the code a zoomable board of live tiles
- One drawable canvas. The tiles are added to it by script.
- Each tile is an element appended to the canvas. A note is a
contenteditable, a page is an<iframe>. - Paint: one
drawElementImage()per tile, under the camera transform.cam.kis the zoom. Text is drawn again at that zoom, so it stays sharp, and the element's hit box follows the draw. A tile that isn't drawn is parked off stage withupdateElementGeometry()so it can't be clicked. - The whole script, with panning, pinch zoom and the minimap.
Drag the background or scroll to pan. Ctrl + wheel or pinch to zoom. Double-click the background for a new note. Drag a tile by its title bar, resize from its corner. Page tiles wake up when you click them; Escape hands the wheel back to the board.
Live checks
| Result | Experiment | Detail |
|---|
Findings
- Zoom is free and sharp.
drawElementImage()under a canvas transform replays the element's paint record, so text is re-rasterised at 800% rather than stretched. Hit testing follows the same transform with no extra code. - Iframes are tiles like any other. A same-origin iframe inside the canvas paints, takes clicks, typing and wheel scrolling at any zoom, and repaints the board when its own content changes. Other HTML-in-canvas pages, a WebGL scene and this board itself all nest.
- An iframe swallows input. Wheel and pointer events inside a frame never reach the board, so each page tile has a cover that hands it the pointer only after a click, the way a map embed does.
- Undrawn doesn't mean unclickable. A tile that is culled or replaced by a placeholder keeps the hit region of its last draw. Park it with
updateElementGeometry()or stale tiles catch clicks. - Drawing order decides stacking. When tiles overlap, the browser hits the one drawn last.
z-indexon the elements changes nothing, so bringing a tile to the front means drawing it later, and iframes never have to move in the DOM. - Focus can drive the camera. Tab still walks every control on the board in DOM order, so a
focusinlistener that pans to the focused tile lets the keyboard reach every tile. - Semantic zoom is a draw decision. Below a threshold a tile is drawn as a labelled rectangle instead of its DOM. It stays in the document, findable and focusable; focusing it zooms back in.