Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Canvas): mouse move before event data #9849

Merged
merged 2 commits into from
May 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## [next]

- fix(Canvas): mouse move before event data [#9849](https://github.com/fabricjs/fabric.js/pull/9849)
- chore(FabricObject): pass `e` to `shouldStartDragging` [#9843](https://github.com/fabricjs/fabric.js/pull/9843)
- ci(): Add Jest coverage to the report [#9836](https://github.com/fabricjs/fabric.js/pull/9836)
- test(): Add cursor animation testing and migrate some easy one to jest [#9829](https://github.com/fabricjs/fabric.js/pull/9829)
Expand Down
2 changes: 1 addition & 1 deletion src/canvas/Canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1117,8 +1117,8 @@ export class Canvas extends SelectableCanvas implements CanvasOptions {
*/
__onMouseMove(e: TPointerEvent) {
this._isClick = false;
this._handleEvent(e, 'move:before');
this._cacheTransformEventData(e);
this._handleEvent(e, 'move:before');

if (this.isDrawingMode) {
this._onMouseMoveInDrawingMode(e);
Expand Down
29 changes: 28 additions & 1 deletion src/canvas/__tests__/__snapshots__/eventData.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,33 @@ exports[`Canvas event data HTML event "wheel" should fire a corresponding canvas

exports[`Event targets should fire mouse over/out events on target 1`] = `
[
[
"mousemove:before",
{
"absolutePointer": Point {
"x": 5,
"y": 5,
},
"e": MouseEvent {
"isTrusted": false,
},
"pointer": Point {
"x": 5,
"y": 5,
},
"scenePoint": Point {
"x": 5,
"y": 5,
},
"subTargets": [],
"target": "target",
"transform": null,
"viewportPoint": Point {
"x": 5,
"y": 5,
},
},
],
[
"mouseover",
{
Expand Down Expand Up @@ -805,7 +832,7 @@ exports[`Event targets should fire mouse over/out events on target 2`] = `
"y": 5,
},
"subTargets": [],
"target": undefined,
"target": "target",
"transform": null,
"viewportPoint": Point {
"x": 5,
Expand Down
Loading