Skip to content

Commit dc70939

Browse files
authored
fix(Canvas): mouse move before event data (#9849)
1 parent 3db87f6 commit dc70939

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
## [next]
44

5+
- fix(Canvas): mouse move before event data [#9849](https://github.com/fabricjs/fabric.js/pull/9849)
56
- chore(FabricObject): pass `e` to `shouldStartDragging` [#9843](https://github.com/fabricjs/fabric.js/pull/9843)
67
- ci(): Add Jest coverage to the report [#9836](https://github.com/fabricjs/fabric.js/pull/9836)
78
- test(): Add cursor animation testing and migrate some easy one to jest [#9829](https://github.com/fabricjs/fabric.js/pull/9829)

src/canvas/Canvas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1117,8 +1117,8 @@ export class Canvas extends SelectableCanvas implements CanvasOptions {
11171117
*/
11181118
__onMouseMove(e: TPointerEvent) {
11191119
this._isClick = false;
1120-
this._handleEvent(e, 'move:before');
11211120
this._cacheTransformEventData(e);
1121+
this._handleEvent(e, 'move:before');
11221122

11231123
if (this.isDrawingMode) {
11241124
this._onMouseMoveInDrawingMode(e);

src/canvas/__tests__/__snapshots__/eventData.test.ts.snap

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,33 @@ exports[`Canvas event data HTML event "wheel" should fire a corresponding canvas
702702

703703
exports[`Event targets should fire mouse over/out events on target 1`] = `
704704
[
705+
[
706+
"mousemove:before",
707+
{
708+
"absolutePointer": Point {
709+
"x": 5,
710+
"y": 5,
711+
},
712+
"e": MouseEvent {
713+
"isTrusted": false,
714+
},
715+
"pointer": Point {
716+
"x": 5,
717+
"y": 5,
718+
},
719+
"scenePoint": Point {
720+
"x": 5,
721+
"y": 5,
722+
},
723+
"subTargets": [],
724+
"target": "target",
725+
"transform": null,
726+
"viewportPoint": Point {
727+
"x": 5,
728+
"y": 5,
729+
},
730+
},
731+
],
705732
[
706733
"mouseover",
707734
{
@@ -805,7 +832,7 @@ exports[`Event targets should fire mouse over/out events on target 2`] = `
805832
"y": 5,
806833
},
807834
"subTargets": [],
808-
"target": undefined,
835+
"target": "target",
809836
"transform": null,
810837
"viewportPoint": Point {
811838
"x": 5,

0 commit comments

Comments
 (0)