Skip to content

Commit

Permalink
fix(Canvas): mouse move before event data (#9849)
Browse files Browse the repository at this point in the history
  • Loading branch information
ShaMan123 committed May 4, 2024
1 parent 3db87f6 commit dc70939
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
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

0 comments on commit dc70939

Please sign in to comment.