Arrange seemingly swaps object positions before laying them out in a grid
#### Summary: When I use the arrange tool, it often swaps the position of objects instead of just aligning them nicely in a grid. #### Steps to reproduce: <!-- Describe what you did (step-by-step) so we can reproduce: --> - open Inkscape - create a few objects - click "arrange" (see attached video for details) #### What happened? Some of the objects were swapped around instead of just adjusted slightly and aligned in a grid. #### What should have happened? The objects positions should have been adjusted slightly and aligned, not swapped. I have attached a a video and an svg file where I want to arrange a few text objects. The objects are already placed roughly in numerical order across two rows and three columns. When I click arrange, I would intuitively expect it to simply adjust vertical placement of the "3" and "1" while keeping the order intact. However, when I click "arrange" it swaps the places of the "3", "4", and "5". ![That_s_what_I_also_expected__but_why_would_the_3__4__and_5_change_place_in_this_example_then_](/uploads/b60d8c0a01ff4349e8abdba1101996de/That_s_what_I_also_expected__but_why_would_the_3__4__and_5_change_place_in_this_example_then_.mp4) In the inkscape rocket chat, @nathanal wrote this explanation for what is happening: > ...the relevant function seems to be `sp_compare_x_position`. It does a comparison based on visual bounding boxes. If two bounding boxes "roughly" overlap, they are considered in the same row and they are compared by x value, otherwise they are compared by y value And submitted this video: ![inkscape-test-arrange-tab](/uploads/e6e10e8b6e7db86be82c46bd0247f8a9/inkscape-test-arrange-tab.mp4) In additional, clicking arrange again keeps swapping tiles for a few rounds until it reaches a steady state where additional click does nothing. This is related to https://gitlab.com/inkscape/inkscape/-/issues/617. This is the SVG file with the numbers ![test-incskape.svg](/uploads/728c5e903d3fc1ac78184c252abddc00/test-incskape.svg) #### Version Info: ``` - Inkscape Version: Inkscape 1.0 (4035a4fb49, 2020-05-01) with Pango version: 1.44.7 - Operating System: Arch Linux - Operating System version: 5.7.7-arch1-1 ```
issue