feat: adds pan and pinch nav mode like figma (#7410)
* Adds Figma pan modes * Added selection on drag * Changed multi selection key code to shift * Changed tests to have correct modifiers
This commit is contained in:
parent
ced8d6d8e5
commit
a2c5090c7a
5 changed files with 13 additions and 20 deletions
|
|
@ -30,6 +30,7 @@ import {
|
||||||
ReactFlow,
|
ReactFlow,
|
||||||
reconnectEdge,
|
reconnectEdge,
|
||||||
SelectionDragHandler,
|
SelectionDragHandler,
|
||||||
|
SelectionMode,
|
||||||
} from "@xyflow/react";
|
} from "@xyflow/react";
|
||||||
import _, { cloneDeep } from "lodash";
|
import _, { cloneDeep } from "lodash";
|
||||||
import {
|
import {
|
||||||
|
|
@ -570,7 +571,9 @@ export default function Page({
|
||||||
onNodeDragStop={onNodeDragStop}
|
onNodeDragStop={onNodeDragStop}
|
||||||
onDrop={onDrop}
|
onDrop={onDrop}
|
||||||
onSelectionChange={onSelectionChange}
|
onSelectionChange={onSelectionChange}
|
||||||
|
selectionMode={SelectionMode.Partial}
|
||||||
deleteKeyCode={[]}
|
deleteKeyCode={[]}
|
||||||
|
multiSelectionKeyCode={["Shift"]}
|
||||||
fitView={isEmptyFlow.current ? false : true}
|
fitView={isEmptyFlow.current ? false : true}
|
||||||
fitViewOptions={{
|
fitViewOptions={{
|
||||||
minZoom: 0.2,
|
minZoom: 0.2,
|
||||||
|
|
@ -579,9 +582,9 @@ export default function Page({
|
||||||
className="theme-attribution"
|
className="theme-attribution"
|
||||||
minZoom={0.2}
|
minZoom={0.2}
|
||||||
maxZoom={3}
|
maxZoom={3}
|
||||||
zoomOnScroll={!view}
|
panOnDrag={[1, 2]}
|
||||||
zoomOnPinch={!view}
|
panOnScroll={!view}
|
||||||
panOnDrag={!view}
|
selectionOnDrag={!view}
|
||||||
panActivationKeyCode={""}
|
panActivationKeyCode={""}
|
||||||
proOptions={{ hideAttribution: true }}
|
proOptions={{ hideAttribution: true }}
|
||||||
onPaneClick={onPaneClick}
|
onPaneClick={onPaneClick}
|
||||||
|
|
|
||||||
|
|
@ -17,15 +17,9 @@ test.describe("group node test", () => {
|
||||||
await page.getByTestId("fit_view").first().click();
|
await page.getByTestId("fit_view").first().click();
|
||||||
|
|
||||||
await page.getByTestId("title-OpenAI").click();
|
await page.getByTestId("title-OpenAI").click();
|
||||||
await page
|
await page.getByTestId("title-OpenAI").click({ modifiers: ["Shift"] });
|
||||||
.getByTestId("title-OpenAI")
|
await page.getByTestId("title-Prompt").click({ modifiers: ["Shift"] });
|
||||||
.click({ modifiers: ["ControlOrMeta"] });
|
await page.getByTestId("title-OpenAI").click({ modifiers: ["Shift"] });
|
||||||
await page
|
|
||||||
.getByTestId("title-Prompt")
|
|
||||||
.click({ modifiers: ["ControlOrMeta"] });
|
|
||||||
await page
|
|
||||||
.getByTestId("title-OpenAI")
|
|
||||||
.click({ modifiers: ["ControlOrMeta"] });
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Group" }).click();
|
await page.getByRole("button", { name: "Group" }).click();
|
||||||
await page.getByTestId("title-Group").click();
|
await page.getByTestId("title-Group").click();
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ test.describe("save component tests", () => {
|
||||||
await zoomOut(page, 2);
|
await zoomOut(page, 2);
|
||||||
|
|
||||||
await page.getByTestId("title-Agent Initializer").click({
|
await page.getByTestId("title-Agent Initializer").click({
|
||||||
modifiers: ["Control"],
|
modifiers: ["Shift"],
|
||||||
});
|
});
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Group" }).click();
|
await page.getByRole("button", { name: "Group" }).click();
|
||||||
|
|
|
||||||
|
|
@ -16,12 +16,8 @@ test.describe("group node test", () => {
|
||||||
.click();
|
.click();
|
||||||
await page.getByTestId("fit_view").first().click();
|
await page.getByTestId("fit_view").first().click();
|
||||||
|
|
||||||
await page
|
await page.getByTestId("title-OpenAI").click({ modifiers: ["Shift"] });
|
||||||
.getByTestId("title-OpenAI")
|
await page.getByTestId("title-Prompt").click({ modifiers: ["Shift"] });
|
||||||
.click({ modifiers: ["ControlOrMeta"] });
|
|
||||||
await page
|
|
||||||
.getByTestId("title-Prompt")
|
|
||||||
.click({ modifiers: ["ControlOrMeta"] });
|
|
||||||
|
|
||||||
await page.getByRole("button", { name: "Group" }).click();
|
await page.getByRole("button", { name: "Group" }).click();
|
||||||
await page.getByTestId("title-Group").click();
|
await page.getByTestId("title-Group").click();
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ test(
|
||||||
await page
|
await page
|
||||||
.getByTestId("title-Combine Text")
|
.getByTestId("title-Combine Text")
|
||||||
.first()
|
.first()
|
||||||
.click({ modifiers: ["ControlOrMeta"] });
|
.click({ modifiers: ["Shift"] });
|
||||||
|
|
||||||
await page.waitForSelector('[data-testid="group-node"]', {
|
await page.waitForSelector('[data-testid="group-node"]', {
|
||||||
timeout: 3000,
|
timeout: 3000,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue