Replies: 1 comment 6 replies
-
The object is probably not rendered becasue is considered out of the viewport.
But i would rather trying to udnerstand what are you doing that fabricJS does not like. |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey y'all.
So I'm working on a real-time collaborative drawing app. One feature is to have a ghost cursor (a
fabric.Circle
object) that will show you where the other users' mice are on the canvas. An issue I'm having is that when you zoom and pan your viewport away from where another user's cursor is, it does not get rendered when it moves into your new viewport area. It will eventually show up when you zoom in/out.Another feature was exhibiting similar behavior as well. This one is a sort of tool tip that shows the current stroke width and location of where your cursor tip is (in the app we are using a pencil icon). I need this tool tip to disappear when the mouse exits the canvas and then reappear when the mouse enters when the user is in "drawing mode". This mostly works except for sometimes the tool tip does not reappear unless you leave and exit the canvas again or change the zoom. This specifically seems to happen when you pan the screen far enough that the last set position of cursor tip is outside the viewport.
Both situations seem to have the same problem. The object being rendered is no longer in the viewport and even after it is moved into the viewport and
canvas.requestRenderAll
is called it does not show up.I made a JsFiddle to showcase the latter situation as I wasn't sure how to do a Socket/RealtimeDB enabled version of the real-time multi-user situation. Now, in writing this I've realized that for the tool tip situation I can actually keep updating the position despite being in pan mode and then just turn on the opacity in draw mode, however, it does illustrate the same problem as the multi-user mouse position indicator so I'll let it as is for now.
I'm really not sure why it's not rendering the object's in the updated position despite having made the render request. I've also tried
canvas.renderAll
but the same issues persists.I should also note that when console.logging the tip/circle object, it seems like it is in the right position but for whatever reason it is not rendered on the canvas.
Thanks in advance for your help.
https://jsfiddle.net/chonigman/a7Lsoj3b/80/
Beta Was this translation helpful? Give feedback.
All reactions