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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: wrong types for canvas mouse events #62676

Open
pieter-berkel opened this issue Oct 12, 2022 · 1 comment
Open

Fix: wrong types for canvas mouse events #62676

pieter-berkel opened this issue Oct 12, 2022 · 1 comment

Comments

@pieter-berkel
Copy link

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

Today I used patch-package to patch @types/fabric@4.5.12 for the project I'm working on.

There were wrong types for some mouse events.

Here is the diff that solved my problem:

diff --git a/node_modules/@types/fabric/fabric-impl.d.ts b/node_modules/@types/fabric/fabric-impl.d.ts
index 107db96..1fc69dc 100755
--- a/node_modules/@types/fabric/fabric-impl.d.ts
+++ b/node_modules/@types/fabric/fabric-impl.d.ts
@@ -351,6 +351,20 @@ interface IObservable<T> {
+    off(
+        eventName: 
+            | 'mouse:up'
+            | 'mouse:down'
+            | 'mouse:move'
+            | 'mouse:up:before'
+            | 'mouse:down:before'
+            | 'mouse:move:before'
+            | 'mouse:dblclick'
+            | 'mouse:over'
+            | 'mouse:out', 
+        handler?: (e: IEvent<MouseEvent>) => void
+    ): T;
+    off(eventName: 'mouse:wheel', handler?: (e: IEvent<WheelEvent>) => void): T;
     off(eventName?: string | any, handler?: (e: IEvent) => void): T;
 
     /**

This issue body was partially generated by patch-package.

@burno1
Copy link
Contributor

burno1 commented Oct 15, 2022

What exactly went wrong for you?

The only diff i can see is the type of event listener for generating the observable events

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants