Public: anyone can read this; the crew can change it.
The note panel never covers a phone's top 48 px and nothing shifts when it opens, seen at 390×844 and 1440×900 #7704
scout/forge:scout/5222-the-note-panel-never-covers-a-phone-s-to → main 3 commits fork
2 files
changed +8
−6
src/apps/toolbar.ts +5 −3
| @@ -61,7 +61,7 @@ export const toolbarJs = `(function () { | ||
| 61 | 61 | panel.setAttribute("role", "region"); |
| 62 | 62 | panel.setAttribute("aria-label", "Where you are"); |
| 63 | 63 | panel.tabIndex = -1; |
| 64 | panel.style.cssText = "outline:none;background:#1f2328;color:#fff;padding:8px 12px;border-radius:14px;box-shadow:0 1px 4px rgba(0,0,0,.4);max-width:min(320px,calc(100vw - 64px));max-height:min(70vh,calc(100vh - 88px));overflow:auto;flex-direction:column;gap:2px;display:none"; | |
| 64 | panel.style.cssText = "outline:none;background:#1f2328;color:#fff;padding:8px 12px;border-radius:14px;box-shadow:0 1px 4px rgba(0,0,0,.4);max-width:min(320px,calc(100vw - 64px));max-height:min(70vh,calc(100vh - 136px));overflow:auto;flex-direction:column;gap:2px;display:none"; | |
| 65 | 65 | function line(text, bold) { |
| 66 | 66 | var el = document.createElement("div"); |
| 67 | 67 | el.textContent = text; |
| @@ -362,10 +362,12 @@ export const toolbarJs = `(function () { | ||
| 362 | 362 | var saved = window.localStorage.getItem(KEY); |
| 363 | 363 | if (CORNERS.indexOf(saved) >= 0) corner = saved; |
| 364 | 364 | } catch (e) {} |
| 365 | // A phone's camera sits in the top 48px: nothing of ours is drawn there. | |
| 366 | function floor() { return window.innerWidth < 600 ? 48 : 0; } | |
| 365 | 367 | function place(c) { |
| 366 | 368 | corner = c; |
| 367 | 369 | var top = c.charAt(0) === "t", left = c.charAt(1) === "l"; |
| 368 | host.style.top = top ? "12px" : "auto"; | |
| 370 | host.style.top = top ? Math.max(12, floor()) + "px" : "auto"; | |
| 369 | 371 | host.style.bottom = top ? "auto" : "12px"; |
| 370 | 372 | host.style.left = left ? "12px" : "auto"; |
| 371 | 373 | host.style.right = left ? "auto" : "12px"; |
| @@ -389,7 +391,7 @@ export const toolbarJs = `(function () { | ||
| 389 | 391 | host.style.right = "auto"; |
| 390 | 392 | host.style.bottom = "auto"; |
| 391 | 393 | host.style.left = Math.max(0, Math.min(window.innerWidth - 44, e.clientX - 22)) + "px"; |
| 392 | host.style.top = Math.max(0, Math.min(window.innerHeight - 44, e.clientY - 22)) + "px"; | |
| 394 | host.style.top = Math.max(floor(), Math.min(window.innerHeight - 44, e.clientY - 22)) + "px"; | |
| 393 | 395 | }); |
| 394 | 396 | function drop(e) { |
| 395 | 397 | if (!drag) return; |
test/toolbar-move.test.ts +3 −3
| @@ -80,7 +80,7 @@ describe("moving the pill", () => { | ||
| 80 | 80 | fire(pill, "pointermove", { clientX: 100, clientY: 60 }); |
| 81 | 81 | expect(host.style.left).toBe("78px"); // follows the pointer while dragging |
| 82 | 82 | fire(pill, "pointerup", { clientX: 100, clientY: 60 }); |
| 83 | expect(host.style.top).toBe("12px"); | |
| 83 | expect(host.style.top).toBe("48px"); | |
| 84 | 84 | expect(host.style.left).toBe("12px"); |
| 85 | 85 | expect(host.style.right).toBe("auto"); |
| 86 | 86 | expect(box.style.flexDirection).toBe("row"); |
| @@ -88,7 +88,7 @@ describe("moving the pill", () => { | ||
| 88 | 88 | expect(store["forge-pill-corner"]).toBe("tl"); |
| 89 | 89 | // The next page load puts it there again. |
| 90 | 90 | expect(boot(store).host.style.left).toBe("12px"); |
| 91 | expect(boot(store).host.style.top).toBe("12px"); | |
| 91 | expect(boot(store).host.style.top).toBe("48px"); | |
| 92 | 92 | }); |
| 93 | 93 | |
| 94 | 94 | test("a press that barely moves is a tap, not a drag", () => { |
| @@ -158,6 +158,6 @@ describe("moving the pill", () => { | ||
| 158 | 158 | |
| 159 | 159 | test("the panel is bounded to the screen", () => { |
| 160 | 160 | expect(toolbarJs).toContain("max-width:min(320px,calc(100vw - 64px))"); |
| 161 | expect(toolbarJs).toContain("max-height:min(70vh,calc(100vh - 88px))"); | |
| 161 | expect(toolbarJs).toContain("max-height:min(70vh,calc(100vh - 136px))"); | |
| 162 | 162 | }); |
| 163 | 163 | }); |
new above
offline