mock: キーを画面の端へ寄せると、キャンバスを自動でスクロールする(T-30 単位4)
ノードのドラッグ中にポインタがSVGの端から32px以内か外にあると、 requestAnimationFrame で pan を動かし続け、DOM更新後の最後のポインタ位置で ドラッグ位置を計算し直す。速度は端に近いほど速く、上限480px/秒(autoPanVelocity)。 範囲選択とパンのドラッグは対象外。 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NznQtmVPoQAnietqwr1auL
This commit is contained in:
@@ -95,6 +95,26 @@ test("ドラッグの刻みをUndo/Redoでき、コンソールにエラーが
|
||||
expect(errors).toEqual([]);
|
||||
});
|
||||
|
||||
test("ドラッグ中に右端で自動スクロールし、Undo 1回で戻る", async ({ page }) => {
|
||||
const key = page.locator('[data-node-type="key"]').first();
|
||||
const before = await key.getAttribute("transform");
|
||||
const keyBox = (await key.boundingBox())!;
|
||||
const canvasBox = (await page.locator("svg.canvas").boundingBox())!;
|
||||
const y = keyBox.y + keyBox.height / 2;
|
||||
await page.mouse.move(keyBox.x + keyBox.width / 2, y);
|
||||
await page.mouse.down();
|
||||
await page.mouse.move(canvasBox.x + canvasBox.width - 8, y, { steps: 8 });
|
||||
const atEdge = await key.getAttribute("transform");
|
||||
await page.waitForTimeout(700);
|
||||
expect(await key.getAttribute("transform")).not.toBe(atEdge);
|
||||
await page.mouse.up();
|
||||
const released = await key.getAttribute("transform");
|
||||
await page.waitForTimeout(250);
|
||||
expect(await key.getAttribute("transform")).toBe(released);
|
||||
await page.getByRole("button", { name: "Undo" }).click();
|
||||
await expect(key).toHaveAttribute("transform", before!);
|
||||
});
|
||||
|
||||
test("クラスター化で画面位置を保つ", async ({ page }) => {
|
||||
const keys = page.locator('[data-node-type="key"]');
|
||||
const centers = async () =>
|
||||
|
||||
Reference in New Issue
Block a user