Window B (wing). Move this window beside the main window on your desktop, then drag the card across the gap between them.
Multi-window canvas world
I wanted to see if one interactive HTML card can straddle the bezel between two Chrome windows positioned in screen coordinates, keep taking input on whichever side holds most of it, and clip cleanly at the canvas edge. Drag the card across the gap below, or open a second window on desktop to span real window frames.
Window A (left)
LIVE AUTHORITY
Window B (right)
PEER MIRROR
AuthorityWindow A (100%)
Card world (x, y)0, 0
Edge clipinside viewport
Handoff routewaiting
Connected peerssplit mode (2 panes)
World topology
Simulated bezel: two panes in one coordinate space.
Tap "Sample edge pixels" after moving the card across a canvas edge to inspect the clipped column.
Show the code screen projection, edge clipping and authority handoff
- Two drawable canvases sharing one card layout. Each pane holds a
<form drawable>; the peer copy staysinertso Tab order stays single-tracked. - Screen-space projection and edge-clipped draw. Each pane subtracts its world origin and calls 5-argument
drawElementImage(el, x, y, w, h), even whenx < 0orx + w > width. - Live DOM authority handoff at 50% overlap. Crossing the midpoint reparents the live form with
moveBefore()in split mode, or syncs value, selection and focus overBroadcastChannelacross windows. - Tap-triggered edge-clipping pixel probe. Copies the drawable canvas with
drawImage()into a plainwillReadFrequentlycanvas before callinggetImageData().
How it works
- One world coordinate space. In multi-window mode, each browser window turns its desktop position (
window.screenX,window.screenY, estimated window chrome thickness and the canvas rect) into a rectangle in desktop CSS pixels. In split-bezel mode, the left pane starts atx = 0and the right pane starts atleftWidth + bezelGap. - Drawing past the edge. Both panes subtract their own viewport origin from the card's world position and call
ctx.drawElementImage(card, localX, localY, cardW, cardH). When the card straddles the seam, the left canvas draws past its right edge and the right canvas draws from a negativelocalX. - Authority handoff at 50%. Every move computes the card's overlap fraction in each viewport. Whichever side holds more than 50% of the card owns live input (not
inert). The other side staysinertand mirrors the text, slider and click count so the protruding half matches pixel for pixel. moveBefore()versusBroadcastChannel. In split-bezel mode (one document), crossing 50% can reparent the live<form>between the two canvases withcanvas.moveBefore()while keeping focus and selection intact. Across two real Chrome windows, each window has its own document, so state and caret selection travel overBroadcastChannel('hic-multi-window')instead.- Screen topology on request. Clicking "Read screen topology" calls
window.getScreenDetails()so you can see every attached display alongside both window rectangles. Nothing prompts on load.
Live checks
| Result | Experiment | Detail |
|---|
Findings
- Negative and overflow offsets clip cleanly in 2D. Passing
x = -w / 2orx > canvasWidth - wto 5-argumentdrawElementImage()does not throw in the check fixture: the protruding half paints up to the canvas boundary and the off-edge portion clips without wrapping. Run the live checks above to verify on your browser. window.screenXandwindow.screenYhave no move event. In multi-window mode, a window only learns that you dragged its OS title bar by polling its coordinates inrequestAnimationFrame()while the stage is visible. Split-bezel mode needs no idle loop and repaints only on drag, resize or input.- Cross-window DOM cannot share one node. In a single document,
moveBefore()can move the live form between two canvases, though both panes still need a secondinertcopy while the card straddles the gap. Across two Chrome windows, state and selection have to crossBroadcastChannel. - Window chrome height is still an estimate.
outerHeight - innerHeightapproximates the tab and address bar height, and vertical alignment across two differently chromed windows (such as a full tab window beside a popup) can differ by a few pixels. Not verified on multi-monitor hardware or Chrome 159 on Android.