feat(editor): allow laser-pointing in view mode (#10802)
* feat(editor): allow laser pointing in view mode * feat: allow switching between laser/hand in view mode * fix lint * factor out to utils * fix: only handle primary clicks with the selection/laser tools
This commit is contained in:
@@ -106,4 +106,26 @@ describe("laser tool interactions", () => {
|
||||
|
||||
handleIframeLikeCenterClickSpy.mockRestore();
|
||||
});
|
||||
|
||||
it("doesn't pan in view mode when laser tool is active", async () => {
|
||||
await render(<Excalidraw />);
|
||||
|
||||
API.setAppState({ viewModeEnabled: true });
|
||||
act(() => {
|
||||
h.app.setActiveTool({ type: "laser" });
|
||||
});
|
||||
|
||||
expect(GlobalTestState.interactiveCanvas.style.cursor).toContain("");
|
||||
|
||||
const initialScrollX = h.state.scrollX;
|
||||
const initialScrollY = h.state.scrollY;
|
||||
|
||||
mouse.downAt(100, 100);
|
||||
mouse.moveTo(180, 160);
|
||||
mouse.upAt(180, 160);
|
||||
|
||||
expect(h.state.scrollX).toBe(initialScrollX);
|
||||
expect(h.state.scrollY).toBe(initialScrollY);
|
||||
expect(GlobalTestState.interactiveCanvas.style.cursor).toContain("");
|
||||
});
|
||||
});
|
||||
|
||||
@@ -504,7 +504,9 @@ describe("tool locking & selection", () => {
|
||||
value !== "image" &&
|
||||
value !== "selection" &&
|
||||
value !== "eraser" &&
|
||||
value !== "arrow"
|
||||
value !== "arrow" &&
|
||||
value !== "hand" &&
|
||||
value !== "laser"
|
||||
) {
|
||||
const element = UI.createElement(value);
|
||||
expect(h.state.selectedElementIds[element.id]).not.toBe(true);
|
||||
|
||||
Reference in New Issue
Block a user