Comment 1 for bug 398715

Revision history for this message
LucaDC (lucadc) wrote :

No, I'm wrong: it's even simpler:
 - the 100 x 100 object with stroke size 1 is actually 101 x 101;
 - we want it to be 50 x 50 with stroke 1, so 51 x 51;
 - but when resizing the stroke first changes: in this case the factor is 1/2 so the new stroke will be 0.5 at first.

The formula is: k = (101 - 1) / (51 - 1) = 100 / 50.
With this you get a 50.5 object with 0.5 stroke width (i.e. the object is 50 without stroke, that's correct).

So the formula in the code is correct if applied to the size of the object with the stroke, but now seems to be applied to the numbers in the W and H fileds in the toolbar that do not consider the stroke.
If you don't consider the stroke the formula is simply: k = newSize/oldSize.
Or you have to add the stroke width before applying the first formula (that's adding to subtract after, but I don't know what's easier to implement in the code).