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 #6016
scout/forge:scout/5222-the-note-panel-never-covers-a-phone-s-to → main 1 commit fork
2 files
changed +8
−6
src/apps/toolbar.ts +5 −3
| @@ -69,7 +69,7 @@ export const toolbarJs = `(function () { | ||
| 69 | 69 | panel.setAttribute("role", "region"); |
| 70 | 70 | panel.setAttribute("aria-label", "Where you are"); |
| 71 | 71 | panel.tabIndex = -1; |
| 72 | 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"; | |
| 72 | 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"; | |
| 73 | 73 | function line(text, bold) { |
| 74 | 74 | var el = document.createElement("div"); |
| 75 | 75 | el.textContent = text; |
| @@ -281,10 +281,12 @@ export const toolbarJs = `(function () { | ||
| 281 | 281 | var saved = window.localStorage.getItem(KEY); |
| 282 | 282 | if (CORNERS.indexOf(saved) >= 0) corner = saved; |
| 283 | 283 | } catch (e) {} |
| 284 | // A phone's camera sits in the top 48px: nothing of ours is drawn there. | |
| 285 | function floor() { return window.innerWidth < 600 ? 48 : 0; } | |
| 284 | 286 | function place(c) { |
| 285 | 287 | corner = c; |
| 286 | 288 | var top = c.charAt(0) === "t", left = c.charAt(1) === "l"; |
| 287 | host.style.top = top ? "12px" : "auto"; | |
| 289 | host.style.top = top ? Math.max(12, floor()) + "px" : "auto"; | |
| 288 | 290 | host.style.bottom = top ? "auto" : "12px"; |
| 289 | 291 | host.style.left = left ? "12px" : "auto"; |
| 290 | 292 | host.style.right = left ? "auto" : "12px"; |
| @@ -308,7 +310,7 @@ export const toolbarJs = `(function () { | ||
| 308 | 310 | host.style.right = "auto"; |
| 309 | 311 | host.style.bottom = "auto"; |
| 310 | 312 | host.style.left = Math.max(0, Math.min(window.innerWidth - 44, e.clientX - 22)) + "px"; |
| 311 | host.style.top = Math.max(0, Math.min(window.innerHeight - 44, e.clientY - 22)) + "px"; | |
| 313 | host.style.top = Math.max(floor(), Math.min(window.innerHeight - 44, e.clientY - 22)) + "px"; | |
| 312 | 314 | }); |
| 313 | 315 | function drop(e) { |
| 314 | 316 | 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