Add Snapping on spline curve handles

Issue #233 on hold
Felix Ulber created an issue

Hey, I would really like to be able to snap the (end points of the) handles of spline curves to adjacent lines/points.

Example cases:

  1. A Curve joining a straight line, ensure continuity (see picure 2 and 3)
  2. A Curve starting with start continuity aligned perpendicular to a line, i.e. joined to the normal. (Picture 1)

How should snapping look like? Two opportunities:

  • Kind of a magnetic snapping
  • With mouse drag and key-combination (which one?).

Comments (31)

  1. Roman Telezhynskyi repo owner

    How do you plan get angle of adjacent line?

    May be better snap value of angle for selected handle if Shift pressed (Ctrl we already use for scale)?

  2. Felix Ulber reporter

    I don't know yet how it actually can be done, I have to get into the drawing code. But this was a thing I almost immediately looked after when playing around with valentina (as a user). Rotating with discrete steps is another feature that woud be nice.

  3. Roman Telezhynskyi repo owner

    I don't think we can implement whole snapping feature. Just snapping we maybe can implement, but a curve will not follow a line angle after changing. For this better use formulas, like we do in other cases. See issue #216 where Susan proposed this. With formula it will more look like manual snapping.

  4. Felix Ulber reporter

    Sounds good. Actually I missed the point that really following the line is better and more in sense of the whole construction process. This request is indeed related to the fact, that you cannot influence the curve handles by value/formula at the moment.

    An interactive procedure would be nice nevertheless, but this is a general/conceptual thing and applies to other tools as well.

  5. Roman Telezhynskyi repo owner

    An interactive procedure would be nice nevertheless, but this is a general/conceptual thing and applies to other tools as well.

    Ok, agree. I will look if we can get data about angles when move curve's handle.

  6. Roman Telezhynskyi repo owner
    1. A Curve joining a straight line, ensure continuity (see picture 2 and 3)
    2. A Curve starting with start continuity aligned perpendicular to a line, i.e. joined to the normal. (Picture 1)

    Can you again explain your pictures? I little bit understood about curvehandles.png. Here we have handle on line A_A1.

    But what about others two? I don't see snapping here.

  7. Susan Spencer

    We need to update the Curve Options dialog box to enable these changes, regardless of how we implement them visually

    A. Replace the 'angle of the control point' field with four radio buttons:

    1. Parallel to two points
    2. Perpendicular to two points
    3. Angle
    4. Formula

    When a radio button is selected the appropriate input fields are enabled (Select 2 points, Enter Angle, or Enter Formula)

    B. Add Yes/No check box to make curve Clockwise.

    C. The Curve options dialog box will appear when:

    • User highlights curve then right clicks on curve and selects 'Options' (current)
    • User highlights curve then right clicks on a control point and selects 'Options' (new)

    D. Add 'Show Curve Details' icon on top menu bar to show/hide control points and curve direction

  8. Susan Spencer

    To enable visual 'snapping', a red 'square' or 'line' could flash when the control point creates a handle that is perpendicular to or inline with an adjacent line.

    The handle would appear as a thick red line at the moment when it becomes inline with an adjacent line, and returns to a thin line when it is not inline.

    A red square would appear at the endpoint at the moment when the handle becomes perpendicular to an adjacent line, and disappears when angle isn't perpendicular.

  9. Roman Telezhynskyi repo owner

    B. Add Yes/No check box to make curve Clockwise.

    Why?

    User highlights curve then right clicks on a control point and selects 'Options' (new)

    Should be easy to do.

    D. Add 'Show Curve Details' icon on top menu bar to show/hide control points and curve direction

    In which section? Pattern piece? Maybe also add toolbutton?

  10. Roman Telezhynskyi repo owner

    A. Replace the 'angle of the control point' field with four radio buttons:

    1. Parallel to two points
    2. Perpendicular to two points
    3. Angle
    4. Formula

    Angle and formula can be one single field. Angle it is just single value. I have plan make it possible. :) Already begin working on it. Need make changes for support unit testing.

    Maybe instead of selection two points use LineAngle_X_X variables? Parallel line will has save angle value. Perpendicular line will has angle+90.

    Also do you know that you can't select point if this point was created after curve?

  11. Roman Telezhynskyi repo owner

    To enable visual 'snapping', a red 'square' or 'line' could flash when the control point creates a handle that is perpendicular to or inline with an adjacent line. The handle would appear as a thick red line at the moment when it becomes inline with an adjacent line, and returns to a thin line when it is not inline. A red square would appear at the endpoint at the moment when the handle becomes perpendicular to an adjacent line, and disappears when angle isn't perpendicular.

    How about text? Changes mouse cursor and text? Visual 'snapping' will work only if user has single value in formula.

    Also i see we need controls for enable/disable snapping.

  12. Roman Telezhynskyi repo owner

    I propose new snapping "Grid". Not visible grid will help more accurate set value.

    And show angle and length when user create segment.

  13. Felix Ulber reporter

    Oh dear, I did not came to answer the question yesterday, and now discussion grew further. Now it is me that has problems to follow you ;) And we have to be careful, because now two different (even if related to each other) things are discussed here: Alignment of Curve handles (thats what my intention was about when starting this issue) and interactivity. Also things get kinda abstract, for some parts I think we need visualized examples.

    Roman, are your questions about the pictures probably somehow answered now? This are basically variants of the same thing: aligning the curve handle to a line - directly or with 90/180 degrees offset.

    At this point from my side interactive snapping, thought it is something I am used to from other graphics applications, becomes less important when I have all possibilities to use lines and stuff in a formula. This is also more matching the construction process with other tools.

    Visual 'snapping' will work only if user has single value in formula.

    yes, I see the point, but as I said this is really more a general design question that is really not limited to this tool and thus should be probably discussed separately.

    Also i see we need controls for enable/disable snapping.

    I still prefer shorcuts for this purpose, but some graphics applications also have e.g. snapping modes.

    I propose new snapping "Grid". Not visible grid will help more accurate set value.And show angle and length when user create segment.

    Sorry, I really do not understand what you mean here. As I said, probably better separate the issues.

  14. Susan Spencer

    Making the curve clockwise during Draw phase. Easier than making the curve clockwise during Layout phase. I think this phrase 'clockwise' is easier for the average user to understand that direction is important, rather than 'Reverse curve'.

    The 'Show Curve Details' would show details similar to the 'Show path effects' and 'Show Bezier handles' icons at the end of the top menu bar in Inkscape. Inkscapes' icons affect the currently selected nodes. Valentina's icon could be selected, and then the user selects the pattern piece. Sometimes it helps understand the pattern by visualizing how the whole thing works.

  15. Roman Telezhynskyi repo owner

    The 'Show Curve Details' would show details similar to the 'Show path effects' and 'Show Bezier handles' icons at the end of the top menu bar in Inkscape. Inkscapes' icons affect the currently selected nodes. >Valentina's icon could be selected, and then the user selects the pattern piece. Sometimes it helps understand the pattern by visualizing how the whole thing works.

    Already working on it.

  16. Susan Spencer

    What text would you suggest? Mouse cursor and text could work too.

    Susan Spencer Valentina Community Manager valentina-project.org http://www.valentina-project.org/ bitbucket.org/dismine/valentina/overview http://bitbucket.org/dismine/valentina/overview groups.google.com/forum/#!forum/valentina-project-list http://groups.google.com/forum/#!forum/valentina-project-list facebook.com/Valentina.Project http://facebook.com/Valentina.Project @ValentinaPSW http://groups.google.com/forum/#!forum/valentina-project-list valentina-project.blogspot.com http://valentina-project.blogspot.com/

  17. Roman Telezhynskyi repo owner

    Making the curve clockwise during Draw phase. Easier than making the curve clockwise during Layout phase. I think this phrase 'clockwise' is easier for the average user to understand that direction is important, >rather than 'Reverse curve'.

    I understand this, but it will not help. I can show you example where same curve for two different work pieces must have opposite direction at the same time.

    Instead i propose make creation workpiece more interactive. Just highlight path. This tool is not finished yet.

  18. Roman Telezhynskyi repo owner

    What text would you suggest? Mouse cursor and text could work too.

    How about left 'Show Curve Details'?

  19. Susan Spencer

    Maybe instead of selection two points use LineAngle_X_X variables? Parallel line will has save angle value. Perpendicular line will has angle+90. The two points don't always have a line between them.

    Also do you know that you can't select point if this point was created after curve? Yes, the order that the points are created is important.

  20. Roman Telezhynskyi repo owner

    The two points don't always have a line between them.

    Who said you can't make this line yourself? I think create new interface it is more difficult then just make line where you need. Now user can change color for a line. In future even hide such lines.

  21. Susan Spencer

    Okay, agreed, make the line and use it's Line_X_X angle. Can we have dashed or dotted lines?

    [image: dismi_] Roman Telezhinskyi commented on issue #233: Snapping

  22. Log in to comment