-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Regression of free drawing pixel shifting bug #5705
Comments
i think is the position fix done a couple of days ago. |
Thanks for reporting the bug |
@asturur nw and thanks! |
Any chance how we can add some custom code in our app to fix this behaviour? Need to publish a prototype next week and can't seem to figure it out on my own |
i think is easy to fix, just i did not have time. |
Thanks a lot for the fast processing of the issue. I just pulled the source and made a build. Checked the dist file to verify it has the proper changes. |
@asturur when I draw a line the line is 15px under the crosshair's center (line is not originating from the center of the crosshair). Adding this code to the object:added event prevent's the line from jumping after drawing, but the drawing itself is still offset. event.target.set({ |
i do not see the issue, can you build a fiddle on fabric 3.1 that show the problem? |
I found it out today since I could not reproduce on fiddle. I had the canvas "top:-15px;" offsetted in the css... |
I'm facing the same issue on version 3.1.0. I've put an example over here. |
that is because you are giving a string to something that expect a number |
I was seeing this today on Fabric.js version 4.2.0 The easy fix was to remove the margin: xxxx from the css for the canvas. Not sure if it is a bug (that css on the canvas disrupts reading the position of the free drawing cursor) but if that is a problem you are having, try removing the css from the canvas, wrapping the canvas in a div, and styling the div instead. |
can you reproduce it on current 4.2.0? |
Here is a complete example that shows the shifting behavior with fabric 4.2.0:
|
would you be able to have it in a jsfiddle and open an issue for it? |
Sorry. I took a quick look at jsfiddle. Not sure how to make it load the latest fabric version. Note that even having only the border styling causes a small shift. |
if you open a new issue, in the template there is linked a jsfiddle template with the latest version loaded. |
Ah. I see! Well. In the jsfiddle, the problem does not appear. I have no idea why. However, in the isolated example above, the problem does appear. |
I am experiencing this in Fiddle here: https://jsfiddle.net/nf1rqusL/4/ |
added a function to fix the shift in the fiddle which you can toggle, but this is not pretty. there's gotta be something I'm missing.
|
Finally I figured this out. In my case, the problem is that It's quite confusing that a width of string value works before mouse up but not on mouse up. For those who still land here, hope this will help~ |
Version
2.4.0
Test Case
http://jsfiddle.net/mw1oybvk/
also evident on http://fabricjs.com/freedrawing
Information about environment
Nodejs or browser? Browser
Which browsers? Chrome
Steps to reproduce
Draw
Expected Behavior
On mouse up, drawn line remains at the exact same coordinates on canvas
Actual Behavior
On mouse up, drawn line shifts coordinates up and left on canvas. Regression of this issue: #4646
The text was updated successfully, but these errors were encountered: