persistent offset when scaling an object with "Scale stroke width" unchecked and "Preserved Transforms"

Bug #1262146 reported by Alvin Penner on 2013-12-18
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Alvin Penner

Bug Description

This is a followup to a thread at:

There are two preference settings that affect scaling of objects: "Scale Stroke Width" and "Store Transformation".
For the case of "no scaling" and "Preserved transforms" there is a persistent offset created by stretching an object. The attached file, stretch.svg, shows 4 identical boxes. The last box has been stretched vertically by dragging the bottom edge, and the height has been offset by this.

Alvin Penner (apenner) wrote :
Alvin Penner (apenner) wrote :

The attached file, collapse.svg, shows what happens after trying to return it back to its original state by dragging the bottom edge up to compress the shape back to a square. The vertical offset remains. If subsequent stretches and collapses are performed then the offset just accumulates and gets worse, never better. While doing these stretches it is important that the mouse must release the object, it is the release and regrabbing that appears to trigger the offset.

Similarly, horizontal stretching by the same edge will lead to horizontal offset. But stretching at an angle of 45 degrees will lead to zero offset. The offset is related to the degree of asymmetry between horizontal motion and vertical motion.

The calculations for doing the scaling are done in the routine get_scale_transform_for_uniform_stroke() in sp-item-transform.cpp. However it appears that the error is occurring upstream, in the parameters that are being fed to this routine. The routine contains info on the last known position at the end of the previous stretch and also the first known position at the beginning of the current stretch. These two should of course be the same, but they are not always the same, which leads to the offset.

Alvin Penner (apenner) on 2013-12-18
summary: persistent offset when scaling an object with "Scale stroke width"
- unchecked and "Optimized Transforms"
+ unchecked and "Preserved Transforms"
su_v (suv-lp) on 2013-12-18
tags: added: stroke transformations
su_v (suv-lp) wrote :

Reproduced with r10795 (archived build) and r12852 (current trunk) on OS X 10.7.5.

tags: added: regression
Changed in inkscape:
importance: Undecided → Medium
milestone: none → 0.91
status: New → Confirmed
Alvin Penner (apenner) wrote :

fix committed to rev 12863

Changed in inkscape:
status: Confirmed → Fix Committed
su_v (suv-lp) wrote :

Revision r12863 breaks scaling of horizontal lines:

Steps to reproduce:
1) prefs: use preserved transforms
2) prefs: don't scale stroke width
3) draw a horizontal line (two nodes)
4) squeeze or stretch the line with the select tool

Expected result:
The line is shortened or lengthened, and the stroke width renders according to the preserved transformation

Actual result:
The path "disappears" - both nodes are repositioned to the SVG origin (upper left corner of the page).

Changed in inkscape:
status: Fix Committed → In Progress
su_v (suv-lp) wrote :

@Alvin - I reopened the report (instead of filing a new one for the regression): could you take a closer look why the transformation is reset to 'scale(0,0)' in the case of horizontal (or vertical) lines?

su_v (suv-lp) wrote :

> Revision r12863 breaks scaling of horizontal lines:

AFAICT the follow-up revision r12864 (prevent singularity when scaling horizontal or vertical line) didn't address the case described in comment #5: I can reproduce it with r12863, 12864 and random later revisions up to current r12935, all tests done on OS X 10.7.5.

Alvin Penner (apenner) wrote :

thanks, I'll look into it.

Alvin Penner (apenner) wrote :

improved patch committed to rev 12951

Changed in inkscape:
status: In Progress → Fix Committed
Alvin Penner (apenner) wrote :

some minor improvements were made in rev 12964.
- the scaling of the stroke of a horizontal line was made to be consistent with the scaling of a nearly horizontal line for the case of "no scaling of stroke"/"preserved transforms"
- there was a persistent offset obtained when the Transform dialog was used to attempt to vertically scale a horizontal line. This operation is not feasible, and should not have any effect on line. The offset was removed.

Bryce Harrington (bryce) on 2014-01-29
Changed in inkscape:
assignee: nobody → Alvin Penner (apenner)
su_v (suv-lp) wrote :

Follow-up report (regression):
- Bug #1286647 “trunk: scaling of stroked clipped objects broken”

Bryce Harrington (bryce) on 2015-02-23
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers