From 0b4bf7bf633570bc9f25fcbeb0c139e458b14832 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 22 Oct 2026 06:19:43 +0000 Subject: [PATCH] Revert pinned home cells: apps flow into free space again This reverts commit 5682d51. Pinning every slot on the first drag left apps stranded alone in rows on the phone; V wants the home to pack apps densely with no holes, as before. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01NYASJ6JNxhYwNNJK7ypK2V --- tests/e2e.cjs | 52 ++++++---------- web/app.py | 163 +++++++++++++++++-------------------------------- web/app.wasm | Bin 15603 -> 14142 bytes web/index.html | 68 ++++++--------------- 4 files changed, 90 insertions(+), 193 deletions(-) diff --git a/tests/e2e.cjs b/tests/e2e.cjs index 260e32a..845b9ec 100644 --- a/tests/e2e.cjs +++ b/tests/e2e.cjs @@ -26,9 +26,7 @@ const BASE = process.env.BASE || "http://localhost:8000"; await p.click(".sheet-item >> text=Check for updates"); await settle(); assert.equal(await p.textContent("#toast"), "Check for updates"); assert.ok(!(await p.$(".sheet")), "the menu closes"); - // home apps in reading order on the grid - const homeApps = () => p.$$eval(".slots .tile", (ts) => ts.map((t) => [t.getBoundingClientRect(), t.textContent]) - .sort(([a], [b]) => Math.round(a.top - b.top) || a.left - b.left).map(([, n]) => n)); + const homeApps = () => p.$$eval(".slots .name", (ns) => ns.map((n) => n.textContent)); // long press on the blank home: add apps through the drawer's pick mode await longpress(".hint"); await p.click(".sheet-item >> text=Add apps"); await settle(); @@ -54,40 +52,27 @@ const BASE = process.env.BASE || "http://localhost:8000"; assert.equal(await p.getAttribute(".widget-slot", "data-wid"), "100"); assert.equal(await p.textContent(".widget-label"), "Clock"); // hold a home app and drag it: reorder - const app = (name) => `.slots .tile:has-text("${name}")`; - const dragBy = async (from, dx, dy) => { - const a = await p.locator(from).first().boundingBox(); + const drag = async (from, to) => { + const a = await p.locator(from).first().boundingBox(), z = await p.locator(to).first().boundingBox(); await p.mouse.move(a.x + a.width / 2, a.y + a.height / 2); await p.mouse.down(); await p.waitForTimeout(650); await settle(); assert.ok(await p.$(".slots > .lifted"), "a long press lifts the slot"); - await p.mouse.move(a.x + a.width / 2 + dx, a.y + a.height / 2 + dy, { steps: 5 }); await settle(); + await p.mouse.move(z.x + z.width / 2, z.y + z.height / 2, { steps: 5 }); await settle(); await p.mouse.up(); await settle(); }; - const drag = async (from, to) => { - const a = await p.locator(from).first().boundingBox(), z = await p.locator(to).first().boundingBox(); - await dragBy(from, z.x - a.x, z.y - a.y); - }; - // the grid runs to the bottom of the screen - const rows = await p.$eval(".slots", (s) => getComputedStyle(s).gridTemplateRows.split(" ").length); - assert.ok(rows >= 6, `rows fill the screen: ${rows}`); - // dropping on an app takes its cell; that app moves to the first free cell - await drag(app("Gmail"), app("Chrome")); + await drag(".slots .tile:nth-child(2)", ".slots .tile:nth-child(1)"); assert.deepEqual(await homeApps(), ["Gmail", "Chrome", "Phone"]); assert.ok(!(await p.$(".sheet")), "a drag doesn't open the menu"); assert.ok(!(await p.$(".slots > .lifted"))); - // an empty cell far down takes an app, and the others stay put - const before = await p.locator(app("Chrome")).boundingBox(); - await dragBy(app("Gmail"), 0, 4 * 84); - const g = await p.locator(app("Gmail")).boundingBox(), c = await p.locator(app("Chrome")).boundingBox(); - assert.ok(Math.abs(g.y - before.y - 4 * 84) < 3, `dropped four rows down: ${g.y - before.y}`); - assert.deepEqual([c.x, c.y], [before.x, before.y], "the other apps stay where they were"); - await p.reload(); await p.waitForSelector(".slots .tile"); - assert.ok(Math.abs((await p.locator(app("Gmail")).boundingBox()).y - g.y) < 3, "the cell is saved"); - // and back up to the empty first cell, left of Chrome - const ph = await p.locator(app("Phone")).boundingBox(); - await dragBy(app("Gmail"), c.x - (ph.x - c.x) - g.x, c.y - g.y); + await drag(".slots .tile:nth-child(1)", ".slots .tile:nth-child(3)"); + assert.deepEqual(await homeApps(), ["Chrome", "Phone", "Gmail"]); + // hold without moving: the menu + await longpress(".slots .tile:nth-child(3)"); + await p.click(".sheet-item >> text=Move earlier"); await settle(); + assert.deepEqual(await homeApps(), ["Chrome", "Gmail", "Phone"]); + await longpress(".slots .tile:nth-child(1)"); + await p.click(".sheet-item >> text=Move later"); await settle(); assert.deepEqual(await homeApps(), ["Gmail", "Chrome", "Phone"]); - await p.mouse.click(5, 300); await settle(); // a tap on empty home ends the drag gesture // swipe down opens the drawer (and takes the widget off screen), search, long press adds const swipe = (y0, y1) => p.evaluate(([y0, y1]) => { const at = (y) => new Touch({ identifier: 1, target: document.body, clientX: 200, clientY: y }); @@ -113,7 +98,7 @@ const BASE = process.env.BASE || "http://localhost:8000"; // persisted; tap launches; remove await p.reload(); await p.waitForSelector(".slots .tile"); assert.equal(await p.$$eval(".slots > li", (ls) => ls.length), 5); - await p.click(app("Gmail")); await settle(); + await p.click(".slots .tile:first-child"); await settle(); assert.equal(await p.textContent("#toast"), "Open com.example.gmail/.MainActivity"); // hold a widget without moving: resize handles; drag them to snap it to the grid await longpress(".widget-slot"); @@ -138,18 +123,15 @@ const BASE = process.env.BASE || "http://localhost:8000"; assert.deepEqual(await size(), [w1, h1], "the size is saved"); // while it shows handles, dragging the widget itself moves it, without another long press await longpress(".widget-slot"); - const atStart = () => p.$eval(".widget-slot", (w) => { - const r = w.getBoundingClientRect(), s = w.parentElement.getBoundingClientRect(); - return Math.abs(r.left - s.left) < 2 && Math.abs(r.top - s.top) < 2; - }); - assert.ok(!(await atStart())); + const order = () => p.$$eval(".slots > li", (ls) => ls.map((l) => l.classList.contains("widget-slot") ? "W" : "a")); + assert.notEqual((await order())[0], "W"); const wb = await p.locator(".widget-slot").boundingBox(), first = await p.locator(".slots > li").first().boundingBox(); await p.mouse.move(wb.x + wb.width / 2, wb.y + wb.height / 2); await p.mouse.down(); await settle(); assert.ok(await p.$(".widget-slot.lifted"), "pressing a widget with handles picks it up"); await p.mouse.move(first.x + first.width / 2, first.y + first.height / 2, { steps: 8 }); await settle(); await p.mouse.up(); await settle(); - assert.ok(await atStart(), "dragged to the first cell"); + assert.equal((await order())[0], "W", "dragged to the front"); // the apps flow into the cells beside it: a 2x2 widget in 5 columns leaves room for all four const beside = await p.$eval(".widget-slot", (w) => { const r = w.getBoundingClientRect(); diff --git a/web/app.py b/web/app.py index 2124a13..76f836f 100644 --- a/web/app.py +++ b/web/app.py @@ -9,14 +9,12 @@ from ui import btn_open, input_open, alert # An Android home screen. The home starts blank: you add apps and widgets to it # with a long press. Swiping down opens the drawer with every app and a search. -# The home grid runs to the bottom of the screen. A long press on a home app or -# widget picks it up: drag it to any cell to move it there (what it lands on -# moves to the first free cells), or let go without moving to get its menu -# (index.html does the dragging). Letting go of a +# A long press on a home app or widget picks it up: drag it to move it, or let go +# without moving to get its menu (index.html does the dragging). Letting go of a # widget that way shows resize handles on its right and bottom edges instead: # dragging them snaps the widget to whole grid columns and rows of app tiles, # within the sizes it allows, and dragging the widget itself moves it, staying -# in that mode once let go. New apps flow into the first free cells. +# in that mode once let go. Apps flow into the free cells beside widgets. # # The native shell (android/) serves this folder in a WebView, answers # apps.json and widgets.json, hosts the widgets as native views over the @@ -88,13 +86,14 @@ PICK_APPS: Const[i32] = 24 PICK_WIDGET: Const[i32] = 25 CHOOSE_WIDGET: Const[i32] = 26 # arg: row in the widget list REMOVE: Const[i32] = 27 # arg: home slot +MOVE: Const[i32] = 28 # arg: home slot; moves it one earlier INFO: Const[i32] = 29 # arg: home slot SETTINGS: Const[i32] = 30 WALLPAPER: Const[i32] = 31 NOTICE_DONE: Const[i32] = 32 RECENTS: Const[i32] = 33 LIFT: Const[i32] = 34 # arg: home slot (long press picks it up) -MOVE_CELL: Const[i32] = 35 # arg: row * 64 + column the lifted slot is dragged to +DRAG_TO: Const[i32] = 35 # arg: home slot the lifted one is dragged over DROP: Const[i32] = 36 # arg: 1 if it was dragged, 0 if just held (opens its menu) WQUERY: Const[i32] = 37 # widget picker search WCLEAR: Const[i32] = 38 @@ -104,8 +103,6 @@ RESIZE_DONE: Const[i32] = 41 GRAB: Const[i32] = 42 # arg: the widget slot showing handles, picked up by its body CHECK_UPDATES: Const[i32] = 43 WIDGET_COLS: Const[i32] = 44 # arg: columns for the widget just added (0: the whole row) -GRID: Const[i32] = 45 # arg: columns * 4096 + rows that fit on the screen -PIN: Const[i32] = 46 # arg: slot * 65536 + row * 64 + column it shows at now CAP: Const[i32] = 512 HOME_CAP: Const[i32] = 200 @@ -139,13 +136,7 @@ hwid: i32[512] = empty(512, dtype=int32) hh: i32[512] = empty(512, dtype=int32) hw: i32[512] = empty(512, dtype=int32) hkey: i32[512] = empty(512, dtype=int32) -# The grid cell a slot is pinned to (column hx, row hy, from 0), or -1: placed -# by the grid's dense flow into the first free cells that fit it. -hx: i32[512] = empty(512, dtype=int32) -hy: i32[512] = empty(512, dtype=int32) nh: i32 = 0 -ncols: i32 = 5 # grid columns, and rows that fill the screen (index.html measures them) -nrows: i32 = 0 next_key: i32 = 1 # Widget providers, for the picker. wlabels: i32[512] = empty(512, dtype=int32) @@ -194,8 +185,6 @@ def init() -> None: hwid[nh] = load_i32_at("ultra.home.wid", i, 0) hh[nh] = load_i32_at("ultra.home.h", i, 120) hw[nh] = load_i32_at("ultra.home.w", i, 0) - hx[nh] = load_i32_at("ultra.home.x", i, -1) - hy[nh] = load_i32_at("ultra.home.y", i, -1) hkey[nh] = next_key next_key += 1 nh += 1 @@ -213,8 +202,6 @@ def save_home() -> None: store_i32_at("ultra.home.wid", i, hwid[i]) store_i32_at("ultra.home.h", i, hh[i]) store_i32_at("ultra.home.w", i, hw[i]) - store_i32_at("ultra.home.x", i, hx[i]) - store_i32_at("ultra.home.y", i, hy[i]) def say(msg: str) -> None: @@ -355,8 +342,6 @@ def push_slot(kind: i32, s: i32, wid: i32, h: i32) -> None: hwid[nh] = wid hh[nh] = h hw[nh] = 0 - hx[nh] = -1 - hy[nh] = -1 hkey[nh] = next_key next_key += 1 nh += 1 @@ -385,55 +370,45 @@ def remove_slot(at: i32) -> None: hwid[j] = hwid[j + 1] hh[j] = hh[j + 1] hw[j] = hw[j + 1] - hx[j] = hx[j + 1] - hy[j] = hy[j + 1] hkey[j] = hkey[j + 1] nh -= 1 save_home() -def slot_w(i: i32) -> i32: - """Columns slot i spans.""" - if hkind[i] == APP: - return 1 - if hw[i] <= 0 or hw[i] > ncols: - return ncols - return hw[i] - - -def slot_h(i: i32) -> i32: - """Rows slot i spans.""" - if hkind[i] == APP: - return 1 - return widget_rows(hh[i]) - - -def clear_cells(i: i32) -> None: - """Unpin the slots under pinned slot i, so they flow into free cells.""" - j: i32 - for j in range(nh): - if j != i and hx[j] >= 0 and hx[j] < hx[i] + slot_w(i) and hx[i] < hx[j] + slot_w(j) \ - and hy[j] < hy[i] + slot_h(i) and hy[i] < hy[j] + slot_h(j): - hx[j] = -1 - hy[j] = -1 - - -def pin_slot(i: i32, col: i32, row: i32) -> None: - """Pin slot i with its top left at col, row (kept on the grid). It may cover others - while it is carried; clear_cells moves them off once it is put down.""" - x: i32 = col - y: i32 = row - if x + slot_w(i) > ncols: - x = ncols - slot_w(i) - if x < 0: - x = 0 - if y < 0: - y = 0 - hx[i] = x - hy[i] = y +def swap_slots(a: i32, b: i32) -> None: + t: i32 + t = hkind[a] + hkind[a] = hkind[b] + hkind[b] = t + t = hstr[a] + hstr[a] = hstr[b] + hstr[b] = t + t = hwid[a] + hwid[a] = hwid[b] + hwid[b] = t + t = hh[a] + hh[a] = hh[b] + hh[b] = t + t = hw[a] + hw[a] = hw[b] + hw[b] = t + t = hkey[a] + hkey[a] = hkey[b] + hkey[b] = t save_home() +def move_slot(a: i32, b: i32) -> None: + """Take slot a out and put it back at b, shifting the slots between.""" + i: i32 = a + while i < b: + swap_slots(i, i + 1) + i += 1 + while i > b: + swap_slots(i, i - 1) + i -= 1 + + def slot_of_widget(wid: i32) -> i32: i: i32 for i in range(nh): @@ -455,7 +430,7 @@ def close_all() -> None: # ---- Update def update(msg: i32, arg: i32) -> None: - global loading, drawer, picking, sheet, item, pending, wloading, chosen, lifted, resizing, regrab, ncols, nrows + global loading, drawer, picking, sheet, item, pending, wloading, chosen, lifted, resizing, regrab i: i32 if msg == LOADED: load_apps(arg) @@ -518,22 +493,11 @@ def update(msg: i32, arg: i32) -> None: resizing = -1 regrab = 1 lifted = arg - elif msg == MOVE_CELL: - if lifted >= 0 and (hx[lifted] != arg % 64 or hy[lifted] != arg // 64): - pin_slot(lifted, arg % 64, arg // 64) - elif msg == GRID: - ncols = arg // 4096 - nrows = arg % 4096 - elif msg == PIN: - i = arg // 65536 - if i >= 0 and i < nh: - hx[i] = arg % 64 - hy[i] = (arg % 65536) // 64 - save_home() + elif msg == DRAG_TO: + if lifted >= 0 and arg >= 0 and arg < nh and arg != lifted: + move_slot(lifted, arg) + lifted = arg elif msg == DROP: - if lifted >= 0 and hx[lifted] >= 0: - clear_cells(lifted) - save_home() if lifted >= 0 and (arg == 0 or regrab == 1): if hkind[lifted] == WIDGET: resizing = lifted @@ -546,9 +510,6 @@ def update(msg: i32, arg: i32) -> None: if resizing >= 0: hw[resizing] = arg // 4096 hh[resizing] = arg % 4096 - if hx[resizing] >= 0: - pin_slot(resizing, hx[resizing], hy[resizing]) - clear_cells(resizing) save_home() elif msg == RESIZE_DONE: resizing = -1 @@ -588,6 +549,11 @@ def update(msg: i32, arg: i32) -> None: remove_slot(arg) sheet = NONE item = -1 + elif msg == MOVE: + if arg > 0: + swap_slots(arg, arg - 1) + sheet = NONE + item = -1 elif msg == INFO: app_info(hstr[arg]) sheet = NONE @@ -669,24 +635,6 @@ def widget_rows(h: i32) -> i32: return k -def view_cell(i: i32) -> None: - """Slot i's place on the grid: its pinned cell if it fits, and its span.""" - s_clear(scratch) - if hx[i] >= 0 and hx[i] + slot_w(i) <= ncols: - s_add(scratch, "grid-column:") - s_add_num(scratch, hx[i] + 1) - s_add(scratch, ";grid-row:") - s_add_num(scratch, hy[i] + 1) - s_add(scratch, "/") - else: - s_add(scratch, "grid-row:") - s_add(scratch, "span ") - s_add_num(scratch, slot_h(i)) - s_add(scratch, ";grid-column-end:span ") - s_add_num(scratch, slot_w(i)) - attr_ref("style", scratch) - - def view_home_slot(i: i32) -> None: row: i32 if hkind[i] == WIDGET: @@ -697,7 +645,12 @@ def view_home_slot(i: i32) -> None: cls_if("resizing", i == resizing) attr_num("data-slot", i) # Its height spans whole rows of app tiles (72px rows, 12px gaps; style.css). - view_cell(i) + s_set(scratch, "grid-row:span ") + s_add_num(scratch, widget_rows(hh[i])) + if hw[i] > 0: + s_add(scratch, ";grid-column:span ") + s_add_num(scratch, hw[i]) + attr_ref("style", scratch) # The native widget view is laid over slots marked live, so only mark # them while nothing covers the home screen. While one is resized the # others step aside, so nothing native covers its handles. @@ -722,8 +675,6 @@ def view_home_slot(i: i32) -> None: cls("tile") cls_if("lifted", i == lifted) attr_num("data-slot", i) - if hx[i] >= 0: - view_cell(i) on_click(OPEN_HOME, i) on_longpress(LIFT, i) view_icon(icons[row]) @@ -770,12 +721,6 @@ def view_home() -> None: el("ul") cls("slots") cls_if("dragging", lifted >= 0) - if nrows > 0 and nh > 0: - # Rows down to the bottom of the screen, so empty cells there take apps too. - s_set(scratch, "grid-template-rows:repeat(") - s_add_num(scratch, nrows) - s_add(scratch, ",4.5rem)") - attr_ref("style", scratch) for i in range(nh): view_home_slot(i) end() @@ -891,6 +836,10 @@ def view_sheet() -> None: if row >= 0: text_ref(labels[row]) end() + if item > 0: + sheet_btn("Move earlier", MOVE, item) + if item < nh - 1: + sheet_btn("Move later", MOVE, item + 1) if hkind[item] == APP: sheet_btn("App info", INFO, item) sheet_btn("Remove from home", REMOVE, item) diff --git a/web/app.wasm b/web/app.wasm index 4c23ea39923b9c18e1b1887dd2c1d37c04971a03..099ad3606a0394da9b007fe94f33fa6c65eedceb 100644 GIT binary patch literal 14142 zcmc&*Uu;xYdOvsm*w?-Tb0LHfLXtb&2_b;_p8yF-e8Dlq7(#%A5VAWA_ShaXo|(*y zAw=25yQLMXP>U)akjevUqt;T9iYla~6;e@4C8Y9zRy^>)LzMMy*etu9-Q~d#RPFEg zoqO-h*hQQ6r6fK+-=FiHbH498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ureGrid(); }, + onRender: () => { fillIcons(); place(); watchDrawer(); }, imports: ({ strs }) => ({ launch: (h) => host.launch(strs[h]), app_info: (h) => host.appInfo(strs[h]), @@ -132,66 +131,34 @@ }), }); - ready = true; - // Messages the shell and the gestures below send (keep in sync with app.py). const RELOAD = 2, HOME = 3, BACK = 4, SWIPE_DOWN = 5, SWIPE_UP = 6, - WIDGET_ADDED = 7, WIDGET_MENU = 8, MOVE_CELL = 35, DROP = 36, RESIZE = 40, GRAB = 42, WIDGET_COLS = 44, - GRID = 45, PIN = 46; - - // The home grid: its columns, and as many rows as fit down to the bottom of the - // screen (app.py lays those out, so the empty cells there are real cells). - const grid = () => { - const slots = document.querySelector(".slots"); - if (!slots) return null; - const cs = getComputedStyle(slots), r = slots.getBoundingClientRect(); - const colW = parseFloat(cs.gridTemplateColumns), gap = parseFloat(cs.columnGap) || 0; - return { left: r.left, top: r.top, cols: cs.gridTemplateColumns.split(" ").length, - colW, gap, cell: parseFloat(cs.gridAutoRows) || 72, rgap: parseFloat(cs.rowGap) || 0 }; - }; - let gridSent = -1; - const measureGrid = () => { - const g = grid(), home = document.querySelector(".home"); - if (!g || !home) return; - const bottom = innerHeight - parseFloat(getComputedStyle(home).paddingBottom); // of the first screen - const rows = Math.max(1, Math.floor((bottom - (g.top + scrollY) + g.rgap) / (g.cell + g.rgap))); - const v = g.cols * 4096 + rows; - if (v !== gridSent) { gridSent = v; app.dispatch(GRID, v); } - }; - const cellAt = (g, x, y) => [Math.max(0, Math.round((x - g.left) / (g.colW + g.gap))), - Math.max(0, Math.round((y - g.top) / (g.cell + g.rgap)))]; + WIDGET_ADDED = 7, WIDGET_MENU = 8, DRAG_TO = 35, DROP = 36, RESIZE = 40, GRAB = 42, WIDGET_COLS = 44; // Dragging a home slot. A long press lifts it (app.py marks it .lifted); moving the - // finger then carries it over the grid to the cell under it (by where it was held); - // letting go drops it there, and whatever it covers moves to the first free cells. Before the first move every slot is - // pinned where it shows, so the rest stay put and its old cell is left empty. + // finger then slides it to the slot under the finger, and letting go drops it there. // Letting go without moving opens its menu instead. A widget showing resize handles // needs no long press: pressing its body picks it up right away (GRAB), and it keeps // its handles when let go. Native widget views take their own touches, so the shell // reports those through widgetGrab/widgetDrag/widgetDrop. let drag = null, dragged = false; // drag: { x, y, moved } from pointerdown - let carry = null; // { dx, dy, cell }: where the lifted slot was held, the cell sent last - const freeze = (g) => { + const slotAt = (x, y) => { + let best = -1, bestD = Infinity; for (const li of document.querySelectorAll(".slots > li[data-slot]")) { - const r = li.getBoundingClientRect(), k = li.classList.contains("lifted") ? 1.12 : 1; // style.css - const [col, row] = cellAt(g, r.left + r.width / 2 * (1 - 1 / k), r.top + r.height / 2 * (1 - 1 / k)); - app.dispatch(PIN, +li.dataset.slot * 65536 + row * 64 + Math.min(col, 63)); + const r = li.getBoundingClientRect(); + const dx = Math.max(r.left - x, 0, x - r.right), dy = Math.max(r.top - y, 0, y - r.bottom); + const d = dx * dx + dy * dy; + if (d < bestD) { bestD = d; best = +li.dataset.slot; } } + return best; }; - const dragTo = (x, y, x0 = x, y0 = y) => { // x0, y0: where the finger went down - const lifted = document.querySelector(".slots > .lifted"), g = grid(); - if (!lifted || !g) return; - if (!carry) { - const r = lifted.getBoundingClientRect(); - carry = { dx: x0 - r.left, dy: y0 - r.top, cell: -1 }; - freeze(g); - } - const [col, row] = cellAt(g, x - carry.dx, y - carry.dy); - const cell = row * 64 + Math.min(col, 63); - if (cell !== carry.cell) { carry.cell = cell; app.dispatch(MOVE_CELL, cell); } + const dragTo = (x, y) => { + const lifted = document.querySelector(".slots > .lifted"); + if (!lifted) return; + const to = slotAt(x, y); + if (to >= 0 && to !== +lifted.dataset.slot) app.dispatch(DRAG_TO, to); }; const drop = (moved) => { - carry = null; if (document.querySelector(".slots > .lifted")) app.dispatch(DROP, moved ? 1 : 0); }; let grabbed = false; @@ -208,7 +175,7 @@ if (!drag || !document.querySelector(".slots > .lifted")) return; if (!drag.moved && Math.hypot(e.clientX - drag.x, e.clientY - drag.y) < 10) return; drag.moved = dragged = true; - dragTo(e.clientX, e.clientY, drag.x, drag.y); + dragTo(e.clientX, e.clientY); }); addEventListener("pointerup", () => { if (drag) drop(drag.moved); drag = null; }); addEventListener("pointercancel", () => { if (drag) drop(drag.moved); drag = null; }); @@ -299,8 +266,7 @@ for (const img of document.querySelectorAll("img.icon")) img.__icon = undefined; }, }; addEventListener("scroll", () => requestAnimationFrame(place), { passive: true }); - addEventListener("resize", () => requestAnimationFrame(() => { place(); measureGrid(); })); - measureGrid(); + addEventListener("resize", () => requestAnimationFrame(place)); // Swipe down on the home screen opens the drawer; swipe up closes it once its // list is scrolled to the end (or doesn't scroll).