React + Fabric.js: Rectangle movement using input not working after manual movement on canvas #10207
Unanswered
hamzajamil-care4u
asked this question in
Q&A
Replies: 2 comments 2 replies
-
You have to use the |
Beta Was this translation helpful? Give feedback.
2 replies
-
I'm using something like this, it work fine form me, i'm sure you will find a way to adapt this to your code
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm working on a project where I'm using React with Fabric.js. I have a rectangle on the canvas that can be moved either by dragging it directly on the canvas or by updating its position through input fields (X and Y coordinates).
What I'm trying to do:
Move the rectangle on the canvas by dragging it or by changing its position through input fields.
The position should be in sync, so when I move the rectangle on the canvas, the input fields update, and when I change the input values, the rectangle moves.
The problem:
After dragging the rectangle directly on the canvas, the input fields no longer update the rectangle’s position in a correct position. This only happens after manually moving the rectangle a few times on the canvas.
Expected behavior:
Both dragging the rectangle on the canvas and changing the input values should update the rectangle's position and stay in sync.
You can also check out my full code on StackBlitz here: https://stackblitz.com/edit/fabric-js-react-ts-pzotk6.
Any ideas on what could be causing the input to stop updating the rectangle after moving it on the canvas?
Beta Was this translation helpful? Give feedback.
All reactions