mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
feat: cycle through selected elements on cmd/ctrl-click
This commit is contained in:
parent
c819b653bf
commit
0e3a5b2042
2 changed files with 58 additions and 1 deletions
|
@ -144,6 +144,52 @@ describe("inner box-selection", () => {
|
|||
});
|
||||
});
|
||||
|
||||
describe("selecting with cmd/ctrl modifier", () => {
|
||||
beforeEach(async () => {
|
||||
await render(<ExcalidrawApp />);
|
||||
});
|
||||
it("cycling through elements under cursor", async () => {
|
||||
const rect1 = API.createElement({
|
||||
type: "rectangle",
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 200,
|
||||
height: 200,
|
||||
backgroundColor: "red",
|
||||
fillStyle: "solid",
|
||||
});
|
||||
const rect2 = API.createElement({
|
||||
type: "rectangle",
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 200,
|
||||
height: 200,
|
||||
backgroundColor: "red",
|
||||
fillStyle: "solid",
|
||||
});
|
||||
const rect3 = API.createElement({
|
||||
type: "rectangle",
|
||||
x: 0,
|
||||
y: 0,
|
||||
width: 200,
|
||||
height: 200,
|
||||
backgroundColor: "red",
|
||||
fillStyle: "solid",
|
||||
});
|
||||
h.elements = [rect1, rect2, rect3];
|
||||
Keyboard.withModifierKeys({ ctrl: true }, () => {
|
||||
mouse.clickAt(100, 100);
|
||||
assertSelectedElements(rect3);
|
||||
mouse.clickAt(100, 100);
|
||||
assertSelectedElements(rect2);
|
||||
mouse.clickAt(100, 100);
|
||||
assertSelectedElements(rect1);
|
||||
mouse.clickAt(100, 100);
|
||||
assertSelectedElements(rect3);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("selection element", () => {
|
||||
it("create selection element on pointer down", async () => {
|
||||
const { getByToolName, container } = await render(<ExcalidrawApp />);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue