-
-
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
Wrong calculation of bounding rect #1929
Comments
I think you are using latest version, probably if we start with this.stroke without color, strokewidth should start with 0 as you say, for consistency. As for now it is still set to 1. But implying "no color" => "no width" is not right to me, why changing a color i should expect a change in dimensions? as from a user perspective is strange, don't you think? Chek PR #1882 there are some changes proposed, some are already merged. |
Yes I'm using the newest version. Hmm yep, maybe you are right. So probably the best option would be to set it to 0 by default. I may consider situation where developer want to have transparent stroke for a moment and still calculate dimensions including stroke. And later he/she can set stroke opaque. So is it going to be 0 value by default in coming PR? I'm using Fabric.js a lot lately and I can contribute. I can make PRs if I find some errors. |
@kangax evaluates directions / decisions. any PR is always welcome. That it doesn't mean it gets merged always, a brief discussion before is welcome even more. |
Yes right backward compatibility is always a problem. It can mess a lot. I can think of solution for that but it's not perfect one. If someone was using strokes so he/she for sure set Ok so I will discuss and contribute :) |
@kangax we do not need any confirmation for this. So we clear confusion. |
i m for counting border even if no fill. and for changing default strokewidth to 0 or default stroke to black. |
Black or transparent? :) |
or strokewdith 1 and stroke black one of this couples |
Let's go with "strokewidth 0, transparent"? |
There are lot of places in the code where we evaluate: Can i start to hunt them? |
Yes! |
Hi, I was using function
getBoundingRect
on the object to detect its width and height but it wasn't real value. Having image of size 200x200 pixels, fromgetBoudingRect()
I get width 200.5 and the same with height. After investigation I got to conclusion that it's because ofsetCoords
function takesthis.strokeWidth
into calculations even thoughthis.stroke
property is undefined, so there is no stroke rendered. I had to setstrokeWidth
to 0 and now calculations are made correctly. Maybe it's not big deal but I would propose two solutions. The default value forstrokeWidth
property should be0
orsetCoords
function should countstrokeWidth
only when stroke is visibile:The ideal solution would be to do both.
The text was updated successfully, but these errors were encountered: