╭ changed ──────────╮ │src/embed/script.js│ ╰───────────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────────────────╮ │ 94 // a real browser navigation to another top-level page (the wasm │ │ 95 // can't render it client-side without server data). │ │ 96 window.location.assign(readWasmString(ptr, len)); │ │ 97 + }, │ │ 98 + _scrollToRect: function (x, y, w, h) { │ │ 99 + // the rect arrives in grid cells; map it to document coordinates │ │100 + // via the measured cell size and the grid origin, then scroll the │ │101 + // minimum needed to bring the widget fully into view │ │102 + if (!cellHeight) measureCell(); │ │103 + const gridTop = grid.getBoundingClientRect().top + window.scrollY; │ │104 + const top = gridTop + y * cellHeight; │ │105 + const bottom = top + h * cellHeight; │ │106 + const viewTop = window.scrollY; │ │107 + const viewBottom = viewTop + document.documentElement.clientHeight; │ │108 + if (top < viewTop) { │ │109 + window.scrollTo({ top }); │ │110 + } else if (bottom > viewBottom) { │ │111 + window.scrollTo({ top: bottom - document.documentElement.clientHeight });│ │112 + } │ │113 }, │ │114 }, │ │115 }; │ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯