Bad gradient snapping

Bug #371001 reported by jazzynico
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Low
Diederik van Lierop
0.48.x
Fix Released
Low
Diederik van Lierop

Bug Description

Steps to reproduce:
1. Enable Snap to node or handles in the snap control bar.
2. Draw an object (lets say a rectangle).
3. Fill it with a radial gradient.
4. Select the gradient and move it around. It snaps even when the gradient handles are far from the bounding box.

Related branches

Revision history for this message
jazzynico (jazzynico) wrote :
Revision history for this message
jazzynico (jazzynico) wrote :

Forgot to write it's on Ubuntu 9.04, Inkscape rev. 21604.
Not reproduced with 0.46

Changed in inkscape:
importance: Undecided → Low
tags: added: regression snapping
Revision history for this message
Daniel Pope (djpope) wrote :

I encountered similar problems with r21549.

The handles are snapping to lines extending infinitely outside of the bounding box. Also, the handle snaps to horizontal and vertical midlines of the bounding box in preference to the edges, which is annoying for creating simple gradient-filled rectangles.

The snapping settings do not affect the snapping for gradient handles except for the global snapping toggle.

This is compounded by a very high default snapping distance of 20px.

All-in-all, my experience trying to create a 200x25px rectangle with a vertical linear gradient fill was extremely frustrating.

jazzynico (jazzynico)
Changed in inkscape:
status: New → Confirmed
Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

First of all, I think this is not a bug. We could question though why it has been designed like this, but I cannot comment on this because it has been like this for a very long time, even before I got involved in the snapping stuff. I can imagine though that it might be useful in some case to snap to infinite lines collinear with the bounding box edges, because a gradient is not necessarily confined to the inner region of an object.

What I do agree upon is that it should be toggleable by the bounding box controls in the snapping toolbar. Would it be sufficient if I implement that? I also noticed that it snapped to the visual bounding box whereas I specified in the preferences to use the geometetrical bbox, so that clearly is a bug.

Changed in inkscape:
assignee: nobody → Diederik van Lierop (mail-diedenrezi)
Revision history for this message
Daniel Pope (djpope) wrote :

Just because it's been like this for a while doesn't make it not a bug. It was not like this in Inkscape 0.46.

I don't think it's useful to *snap* to infinite lines. You might want to extend a gradient outside the box, but then it's rare that you care that the handle is exactly snapped to some imaginary line. Holding Ctrl to force the gradient to be exactly horizontal or vertical is much more useful.

The main problem here was that Inkscape is prioritizing the snap points wrongly. I was trying to get the handle to snap to the bounding box but it would always snap to something else - even when the handle was right over the bbox! In my experience, for gradient snapping, the bbox seems to be a much more useful place to snap than anywhere else and should take priority over midpoints and so on. But the snap region for the bbox seems to be eliminated completely or almost completely when the shape is very narrow in width or height.

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote : Re: [Bug 371001] Re: Bad gradient snapping

On 08/03/2009 12:16 PM, Daniel Pope wrote:
> I don't think it's useful to *snap* to infinite lines. You might want to
> extend a gradient outside the box, but then it's rare that you care that
> the handle is exactly snapped to some imaginary line.

... and if people really need this then they could add an additional
guide for this. So this is what should be done then:
1) snap to the real bounding box instead of infinite lines
2) use the correct bounding box (visual vs. geometric)
3) obey to the controls in the snap toolbar

This would also get rid of the custom code that's currently being used
for the gradient dragging, which will make it's behaviour more similar
to the other tools and which will make the code base easier to maintain.

> Holding Ctrl to force the gradient to be exactly horizontal or vertical is much more useful.
>
But that already works, right?
> The main problem here was that Inkscape is prioritizing the snap points
> wrongly. I was trying to get the handle to snap to the bounding box but
> it would always snap to something else - even when the handle was right
> over the bbox!
I don't think this is wrong. Because everything is within snapping
range, it will consider all points (corners, intersections, origins,
nodes) and all lines (grid/guides, boundingboxes, paths). If Inkscape
finds both a line and a point, then it will always snap to the point
because that point is fully constrained whereas snapping to a line only
gives a 1D constraint. This is why for example Inkscape snaps to grid
line intersections instead of the grid lines themselves (if "always
snap" is on for snapping to grids). I tried to implement this
consistently, everywhere Inkscape. That's why in this case Inkscape
snaps to the intersection of the vertical bounding box edge with the
infinite line running horizontally through the middle of the bounding
box, just because that intersection is within snapping range and
produces a fully constrained snap. Now if you want to snap to the
bounding box edge instead of to the intersection, you will have to
reduce the snapping range or zoom in (because the snapping range is
measured in screen-pixels, not in document pixels). Your other option
would be to use the snap toolbar to disable the snapping to
intersections, but I would have to fix that first ;-)

Diederik

Revision history for this message
Daniel Pope (djpope) wrote :

I agree, but in the version of Inkscape I tried that's not what happens. It's not the intersection of a midline and the bbox that was snapped to. IIt was the centre point of the shape's bbox in preference to everything else that was snapped to, which proved very frustrating for me.

Again, this is for very narrow or very shallow bboxes, Try the gradient snapping on a shape of around 25px tall/wide.

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

> I agree, but in the version of Inkscape I tried that's not what happens.
> It's not the intersection of a midline and the bbox that was snapped to.
> IIt was the centre point of the shape's bbox in preference to everything
> else that was snapped to

In that case it probably snapped to the intersection of the vertical and horizontal midlines of the bounding box.

> Again, this is for very narrow or very shallow bboxes, Try the gradient
> snapping on a shape of around 25px tall/wide.

Of course I tried. Zooming in helps, doesn't it? If you make that small rectangle fill your screen completely then it should be quite easy to avoid snapping to that intersection in the middle... until you get too close again, e.g. within 20 screen pixels.

Revision history for this message
Diederik van Lierop (mail-diedenrezi) wrote :

This should have been fixed in today's rev. #8932. Snapping of gradient handles now behaves just like all other snapping.

Please tell me what you think of it!

Changed in inkscape:
status: Confirmed → Fix Committed
Revision history for this message
jazzynico (jazzynico) wrote :

Fix confirmed on Ubuntu 9.10. Thanks Diederik!

jazzynico (jazzynico)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.