Resizing objects on toolbar is not precise
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Confirmed
|
Medium
|
Unassigned |
Bug Description
I remeber this has already been reported but I can't find where. So I'm filing a new bug report: if someone finds the duplicate feel free to mark it.
Having stroke width not scaling with objects (the button in the toolbar is not pressed), if you use the two input fields W and H to set the size of an object you don't get what you input.
For example:
- draw a 100 mm x 100 mm square;
- set its stroke width to 1 mm;
- edit its W to 50: when you press enter you get 49,49495 mm (and the rectangle is 49,49495 mm large);
- edit its H to 50: when you press enter you get 49,49495 mm (and the rectangle is 49,49495 mm tall).
If you set the stroke width to 5 mm, after resizing to 50 mm you get 47,368 mm.
The two numbers are: (50-1)/(100-1)*100 and (50-5)/(100-5)*100. So I assume that stroke width is always considered when calculating the multiplication factor for rescaling an object.
Anyway, this is wrong: the correct formula is: (50+1)/(100+1)*100 (or (50+5)/
All this if I correctly understood the math under this transformation.
I hope this helps.
tags: | added: ui ui-selection-group-layer |
tags: |
added: selection transformations removed: ui-selection-group-layer |
Changed in inkscape: | |
importance: | Undecided → Medium |
status: | New → Confirmed |
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).