mirror of
https://github.com/excalidraw/excalidraw.git
synced 2025-05-03 10:00:07 -04:00
Fix hit testing threshold (#969)
* Fix hit testing threshold - The bounding box was not correctly extended to take into account the threshold. It was only for y axis but not x. - The bezier threshold was using 20 instead of 10 and not taking into account zoom level. Both those issues are fixed and now the behavior looks good on all the shapes I can test. * fix_tests
This commit is contained in:
parent
2937efacde
commit
fed7054114
2 changed files with 56 additions and 11 deletions
|
@ -163,10 +163,23 @@ describe("select single element on the scene", () => {
|
|||
fireEvent.keyDown(document, { key: KEYS.ESCAPE });
|
||||
}
|
||||
|
||||
/*
|
||||
1 2 3 4 5 6 7 8 9
|
||||
1
|
||||
2 x
|
||||
3
|
||||
4 .
|
||||
5
|
||||
6
|
||||
7 x
|
||||
8
|
||||
9
|
||||
*/
|
||||
|
||||
const tool = getByToolName("selection");
|
||||
fireEvent.click(tool);
|
||||
// click on a line on the rectangle
|
||||
fireEvent.pointerDown(canvas, { clientX: 45, clientY: 20 });
|
||||
// click on a line on the arrow
|
||||
fireEvent.pointerDown(canvas, { clientX: 40, clientY: 40 });
|
||||
fireEvent.pointerUp(canvas);
|
||||
|
||||
expect(renderScene).toHaveBeenCalledTimes(7);
|
||||
|
@ -175,7 +188,7 @@ describe("select single element on the scene", () => {
|
|||
expect(h.appState.selectedElementIds[h.elements[0].id]).toBeTruthy();
|
||||
});
|
||||
|
||||
it("arrow", () => {
|
||||
it("arrow escape", () => {
|
||||
const { getByToolName, container } = render(<App />);
|
||||
const canvas = container.querySelector("canvas")!;
|
||||
{
|
||||
|
@ -188,10 +201,23 @@ describe("select single element on the scene", () => {
|
|||
fireEvent.keyDown(document, { key: KEYS.ESCAPE });
|
||||
}
|
||||
|
||||
/*
|
||||
1 2 3 4 5 6 7 8 9
|
||||
1
|
||||
2 x
|
||||
3
|
||||
4 .
|
||||
5
|
||||
6
|
||||
7 x
|
||||
8
|
||||
9
|
||||
*/
|
||||
|
||||
const tool = getByToolName("selection");
|
||||
fireEvent.click(tool);
|
||||
// click on a line on the rectangle
|
||||
fireEvent.pointerDown(canvas, { clientX: 45, clientY: 20 });
|
||||
// click on a line on the arrow
|
||||
fireEvent.pointerDown(canvas, { clientX: 40, clientY: 40 });
|
||||
fireEvent.pointerUp(canvas);
|
||||
|
||||
expect(renderScene).toHaveBeenCalledTimes(7);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue