Align dialog should have "Relative to" for nodes, too

Bug #171287 reported by Thorwil on 2006-05-18
68
This bug affects 10 people
Affects Status Importance Assigned to Milestone
Inkscape
Medium
Mc

Bug Description

The Align and Distribute dialog should have a "Relative
to" dropdown menu when used with the node tool, too.
Even if it would only contain "First selected" and
"Last selected".
This would improve consitency and be informative, where
now the user can only guess/try what will happen.

Related: [ 1294310 ] Align nodes to center or average

I'd just like to second this, I think it would be very
helpful to be able to align a set of selected nodes to:

- the top node in the set

- the bottom node

- left

- right

- horizontal center of set

- veritcal center of set

- first selected

- last selected

Hystrix (hystrix-) on 2007-12-20
Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
Krzysztof Kosinski (tweenk) wrote :

Implementation suggestion: drop the node-specific buttons in the A&D dialog, and instead gray out the normal buttons which are not applicable for nodes.

su_v (suv-lp) on 2010-05-19
tags: added: aligning ui
removed: ui-dialogs-toolbars
thorwil (t-w-) wrote :

In the 0.47 series, align nodes was stuck in relative-to-last-selected mode. While breaking the expectation of following the combox like the commands for aligning objects do, this was at least a perfectly useful setting, just one you had to remember.

With 0.48 (pre1), it is relative-selection, i.e. averaging coordinates. In several years of sometimes intense use, I never had a use for that mode. My current workaround is to copy/paste coordinates instead ...

I hope this can be rolled back, if the proper fix can't make it into the release.

su_v (suv-lp) wrote :

See also <https://bugs.launchpad.net/inkscape/+bug/457749/comments/9>:
With the old node tool, both aligning methods were available:
- last selected: using the 'Align&Distribute' dialog
- averaged coordinates: using the integrated 'align' function for multiple selected nodes in the x-, y-entry fields on the node tool controls bar (added in revision 4174)

The new node tool is limited to averaging the coordinates of the selected nodes in the 'Align&Distribute' dialog.

birdsaregood (ariel36) wrote :

I agree with thorwil. The new 'average' system is very annoying and has already made some of my work more difficult. If you're not going to have various options for alignment modes, at least revert to the default 'last selected'.

Kjohrf (kjohrf) wrote :

Since this is a change from what many considered useful behavior, I hope the priority will be raised above "Wishlist". Thanks!

Edie (ktwister) wrote :

Node alignment is something that i use a lot, and without some other option than 'average' align i can't use v0.48

su_v (suv-lp) wrote :

@Krzysztof - could you take a look at this problem? Would it be possible to restore the old behavior (averaging nodes via x/y fields on the node tool controls bar, aligning nodes to last selected in the 'Align&Distribute' dialog)? Or add an option (either to the preferences or the 'Align&Distribute' dialog) to allow choosing between the two methods?

Many users ask about the old behavior (Inkscape 0.47) to align nodes to the last selected node and do not appreciate the current averaging mode.

Changed in inkscape:
assignee: nobody → Krzysztof Kosinski (tweenk)
importance: Wishlist → Medium
periodic (periodic) wrote :

I totally agree with this! Using a median approach has very little use.

I also don't see why there must be any special arrange and distribute for nodes. In this respect nodes are just point objects and should be handled exactly the same way as any other object. Some align and distribute options will mean the same thing for a point. But that is irrelevant to me as a user. If I select arrange centers or arrange for distance I don't care that they would be the same thing for nodes. It is also counter intuitive and does not add anything to have special align and distribute for nodes.

Michele (michele-iovieno) wrote :

The thread is a bit old (I discovered it since I installed version 0.48 in the windows partition, I still have version 0.47 in my linux partition), but I too found almost useless a median approach to align points in version 0.48. In version 0.47 it was already possible to choose the criterion (I often, but not always, used "relative-to-the-last" criterion), I don't understand why this feature was removed in version 0.48. I use a lot the node alignment and as result I was forced to revert back to version 0.47.

Edie (ktwister) wrote :

Oh.. i am not sure if i should post this here, but it seems that this bug is somehow forgotten. Two new versions of Inkscape since then and node alignment is still useless....

Xortex (xortex) wrote :

su-v: test out this proposed fix thanks ;)

su_v (suv-lp) wrote :

@Samuel - a few notes after an initial (quick) test:

1) compiler warning (GCC 4.2.1, Mac OS X 10.5.8 (i386)):
  CXX ui/dialog/align-and-distribute.o
ui/dialog/align-and-distribute.cpp: In member function ‘Inkscape::UI::MultiPathManipulator::TargetMode Inkscape::UI::Dialog::AlignAndDistribute::getNodeAlignTarget()’:
ui/dialog/align-and-distribute.cpp:1335: warning: control reaches end of non-void function

2) option 'Relative to' 'First|Last node'
Result is somewhat unpredictable (often times the last selected node [1] seems to be used even if the option had been set to 'First node').
Result possibly also differs depending on whether a start or end node is among the selection (or selected as 'First' node)
- What triggers an update of the list of selected nodes (and their selection order) if the dialog is kept open in the dock? [2]
- Does 'First|Last' actually refer to the sequence in which the nodes had been selected, or is it the first|last node of the selected nodes with regard to the path direction? [3]

I haven't yet tested aligning nodes in multi-path editing mode nor with nodes from different sub-paths.

[1] quick test was a zig-zag path (7 nodes, no curved segments, not closed)
    initial node selected with LMB click, additional nodes with 'Shift+LMB'
[2] e.g. if the selection of nodes changes, but not the option 'Relative to':
    deselect all, select new nodes, align with unchanged 'Relative to' option
[3] the preferences pane of the node tool has a setting to visualize the path direction for path outlines

Xortex (xortex) wrote :

Thanks su-v

I made some changes and took out the first/last node options for the time being
I have included my updated patch

Xortex (xortex) wrote :

Please ignore comment number 14,
I made a very slight change to the patch so use this one that is attached to this comment.

Xortex (xortex) wrote :

I changed the patch again su-v so that the "Average" Option is first

su_v (suv-lp) wrote :

Patch tested with Inkscape 0.48+devel r10740 on Mac OS X 10.5.8 (i386):

- As discussed on irc, the option 'Relative to' 'First|Last selected' node requires a major rewrite of internal functions (selection handling (list vs set) in the node tool), and could (hopefully will ;) ) be added later on.

- With regard to the order of the options in the dropdown list: 'Average' as default entry seems best to me (besides having been the (single) default mode in 0.48.x, it applies equally to both horizontal and vertical alignment, whereas the other options (Top Node|Bottom Node|Left Most Node|Right Most Node) might be chosen depending on the alignment task).
After taking a closer look at the options for 'Align nodes', maybe making "Average" the default while keeping it at the bottom would be best after all? For aligning objects, 'Selection' is the default, while being the last option in the list.

- Preferences: AFAICT (with my limited knowledge about C++), you reuse the preferences setting of the 'Relative to' option for objects ("align-to"). IMHO object and node alignment need independent preferences for 'Relative to' because the items in the two lists do not correspond or relate by their order (i.e. the two lists don't or should not share the same last used value).

- Default value: AFAICT, the current default (if the preference 'align-to' doesn't exist yet), is '4' (i.e. "Right Most Node"):

from src/ui/dialog/align-and-distribute.cpp, line 1053:
    _node_anchor_combo.set_active(prefs->getInt("/dialogs/align/align-to", 4));

Shouldn't it either default to '0', or else 'Average' be moved back down to the bottom of the list again (maybe best)? [1]

- Compiler warning is still present (GCC 4.2.1):
  CXX ui/dialog/align-and-distribute.o
ui/dialog/align-and-distribute.cpp: In member function ‘Inkscape::UI::MultiPathManipulator::TargetMode Inkscape::UI::Dialog::AlignAndDistribute::getNodeAlignTarget()’:
ui/dialog/align-and-distribute.cpp:1334: warning: control reaches end of non-void function

[1] Sorry for my confusing comments earlier on irc - my mistake: probably the earlier version of the patch did what I actually wanted - only that it reused the value stored in 'align-to' for objects, and thus not default to 'Average'.

Xortex (xortex) wrote :

Ok try this one....

Average is placed at the end of the list and it is the default option

su_v (suv-lp) wrote :

> Ok try this one....

@Samuel - sorry for being so fussy about the changes in the previous patches ;)

The last one (from 2011-11-19) looks ok to me:
- align nodes 'Relative to' now defaults to 'Average'
  (with new default prefs, as well as when first run with existing prefs)
- remembers last used 'Relative to' option for objects and nodes independently

@Krzysztof - any chance you could review the patch and commit it if ok? It would allow the changes to be tested in nightly builds to get some user feedback about this first set of additional options for aligning nodes.

Krzysztof Kosinski (tweenk) wrote :

Sorry for the delay. Here are my suggestions:
1. Please run the algorithms on the _points structure instead of copying the position to a new vector. This way you only have to define comparison functors for ControlPoint. You can reuse the implementations for Geom::Point. If you can't figure out how to do this, use a vector of Geom::Point instead of defining a new structure that does not obey naming conventions.
2. I don't think it's necessary to have 2 enums with the same contents. At the very least, use the same numbering of constants in both enums and then use a reinterpret_cast instead of a switch to convert one to the other.
3. Use std::min_element and std::max_element instead of std::sort when top, bottom, left or right is chosen.
4. "Average" is mislabeled. The way you wrote it, it aligns the nodes to the middle of their bounding box before the operation, which is different from their average position. The label should be "Center".

Aside from this the patch looks OK, so I will commit it once these are addressed.

Further thoughts: maybe the node-specific buttons should be removed, and only the generic align to left/right/top/bottom buttons should stay. This would be more consistent. Right now you are trying to use a combo box for a different thing than in the object alignment options.

Krzysztof Kosinski (tweenk) wrote :

Oops, forgot about:
5. Follow naming conventions by using words_with_underscores for parameter names and local variables.

Cip Man (cipman-p) wrote :

Any news, please? It's been 9 years since OP ...

jazzynico (jazzynico) wrote :

Patch updated for trunk r14202 (patch tested on Windows XP).

Please test and review.

Changed in inkscape:
milestone: none → 0.92
status: Confirmed → In Progress
su_v (suv-lp) wrote :

Alternative patch (fewer options), also pending review:
* Bug #1187320 “A patch that allows node alignment to align to the first or the last selected node”
  https://bugs.launchpad.net/inkscape/+bug/1187320

su_v (suv-lp) wrote :

@JazzyNico - updated patch fails to compile with up-to-date Gtk+ 2.24.28 and gtkmm 2.24.4 (on OS X 10.7.5), build log attached.

jazzynico (jazzynico) wrote :

@~suv - Thanks for the test. The official win32 devlibs are rather old now... I'll try to test on Xunbuntu 15.04 later this week.

su_v (suv-lp) wrote :

This modified version of the patch did compile (changing 'append_text' to 'append'), and works (quick test only).

Possibly similar issue which came up earlier - according to bug #1065886 and bug #1067008 though, 32bit devlibs should be updated by now?
http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/11787

jazzynico (jazzynico) wrote :

Screenshot of the patched A&D dialog.

Mc (mc...) on 2016-03-13
Changed in inkscape:
assignee: Krzysztof Kosinski (tweenk) → Mc (mc...)
status: In Progress → Fix Committed
Mc (mc...) wrote :

I was working on alignment verbs in the node editing context, so I also included an enhanced fix for this bug.
(possible values are First/last selected node, min/max values, middle value(current behaviour) )

Committed in r14703

Bryce Harrington (bryce) on 2017-01-10
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

Related questions