feat: F5.6d a drag is one change of the document; the others see it through the presence
Moving a device, moving or resizing a documentation item went into the shared document at every pointer move: 59 updates a second, each leaving about 18 bytes of history (M4 on test-filius). Now the editor keeps the drag while it lasts, shows it itself and tells the others through the awareness (moving, at most every 50 ms, the end at once), and writes it once when it is let go. A drag the browser cancels or a second finger turns into a pinch is written where it is; WebKit sends a second pointerdown for the first finger when another comes, which had lost the drag. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -138,6 +138,37 @@ test('zooms the surface with two fingers and never the page (M7)', async ({ page
|
||||
expect(await page_()).toEqual({ scale: 1, x: 0, y: 0 });
|
||||
});
|
||||
|
||||
test('puts a device or an item down where it is when a second finger comes or the browser takes the touch', async ({ page }) => {
|
||||
for (const gesture of ['dragThenPinch', 'dragThenCancel'] as const) {
|
||||
// Each on a fresh page: the pinch zooms, and the next device would be elsewhere.
|
||||
await openEditor(page, server.base, 'zwei_rechnernetze_komplett.fls');
|
||||
const finger = await fingers(page);
|
||||
const id = (await drawing(page)).nodes[0]!.id;
|
||||
const before = (await drawing(page)).nodes.find((node) => node.id === id)!;
|
||||
const from = await onDevice(page, id);
|
||||
await finger[gesture](from, { x: from.x + 40, y: from.y + 60 });
|
||||
// In the document, not only on the screen: the drag ended there and then.
|
||||
await expect
|
||||
.poll(async () => {
|
||||
const now = (await drawing(page)).nodes.find((node) => node.id === id)!;
|
||||
return now.x !== before.x || now.y !== before.y;
|
||||
}, { message: gesture })
|
||||
.toBe(true);
|
||||
const shown = await page.locator(`g.device[data-node="${id}"]`).getAttribute('data-box');
|
||||
await page.waitForTimeout(300);
|
||||
expect(await page.locator(`g.device[data-node="${id}"]`).getAttribute('data-box')).toBe(shown);
|
||||
}
|
||||
// A rectangle of the documentation, its drag taken by the browser: it too stays where it was dragged.
|
||||
await openEditor(page, server.base, 'nat_with_mapped_port.fls');
|
||||
const finger = await fingers(page);
|
||||
await page.locator('button[name="documentationMode"]').tap();
|
||||
const rectangle = (await drawing(page)).docs.find((item) => item.kind === 'rectangle')!;
|
||||
const area = (await page.locator(`g[data-doc="${rectangle.id}"]`).boundingBox())!;
|
||||
const middle = { x: area.x + area.width / 2, y: area.y + area.height / 2 };
|
||||
await finger.dragThenCancel(middle, { x: middle.x + 40, y: middle.y + 30 });
|
||||
await expect.poll(async () => (await drawing(page)).docs.find((item) => item.id === rectangle.id)!.x).not.toBe(rectangle.x);
|
||||
});
|
||||
|
||||
test('reaches every action without a right click: a long press, the three-dot button, the documentation', async ({ page }) => {
|
||||
await openEditor(page, server.base, 'zwei_rechnernetze_komplett.fls');
|
||||
const finger = await fingers(page);
|
||||
|
||||
Reference in New Issue
Block a user