Move a widget by dragging it while it shows resize handles
Holding a widget and letting go puts it in edit mode (resize handles). Now pressing the widget's body in that mode picks it up right away, without another long press: drag it to a new spot and it drops back into edit mode so it can be resized or moved again. The handles still resize. Natively, the page marks the widget in edit mode in placeWidgets, and its WidgetView takes the press as a drag (widgetGrab) instead of passing it to the widget. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0126xtn5CLB47ph1Njd7frgW
This commit is contained in:
5 files changed
+65
-13
No files matched your search
@@ -116,7 +116,19 @@ const BASE = process.env.BASE || "http://localhost:8000";
|
||||
assert.ok(!(await p.$(".resize-handle")));
|
||||
await p.reload(); await p.waitForSelector(".widget-slot");
|
||||
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 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.equal((await order())[0], "W", "dragged to the front");
|
||||
assert.ok(await p.$(".widget-slot.resizing"), "it keeps its handles after the move");
|
||||
assert.ok(!(await p.$(".sheet")));
|
||||
await p.click(".resize-bar >> text=Remove"); await settle();
|
||||
assert.ok(!(await p.$(".widget-slot")));
|
||||
await p.evaluate(() => { window.ultraHome.reload(); }); await settle();
|
||||
|
||||
Reference in new issue
Block a user