Bug 44266 - Objects taken from the gallery do not align to the grid (objects should have an anchor point)
Summary: Objects taken from the gallery do not align to the grid (objects should have ...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
(earliest affected)
3.5.0 Beta2
Hardware: All All
: low enhancement
Assignee: Not Assigned
Keywords: accessibility
: 92604 (view as bug list)
Depends on:
Blocks: Gallery Draw-Images
  Show dependency treegraph
Reported: 2011-12-29 04:30 UTC by sergio.callegari
Modified: 2021-02-27 18:58 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:

possible example (11.30 KB, application/vnd.oasis.opendocument.graphics)
2012-07-06 05:56 UTC, sasha.libreoffice
Tet case (7.96 KB, application/vnd.oasis.opendocument.graphics)
2013-05-30 09:34 UTC, sergio.callegari
More difficult test case (8.15 KB, application/vnd.oasis.opendocument.graphics)
2013-05-30 10:21 UTC, sergio.callegari

Note You need to log in before you can comment on or make changes to this bug.
Description sergio.callegari 2011-12-29 04:30:50 UTC

When an object is taken from the gallery, it does not align to the grid. This makes using the gallery an uncomfortable experience for those making scientific presentations or drawing technical stuff such as schematics, block diagrams, etc.
In this case, every time an object is taken from the gallery one needs to

1) Drag object from the gallery to the drawing
2) Select the objects
3) Right click to get the contextual menu
4) Select position and size
5) Manually fix the object position to align it to the grid by entering numeric x and y coordinates

This is really really cumbersome.

It would be great if a single anchor point could be attached to graphical objects (e.g. using a similar interface to that used to attach glue points to objects).

When an object with an anchor point is put in the gallery, and then taken out of it, if the grid is on, the object should move so that the anchor point stays on grid.

BTW, the anchor point should probably also be the default center point for rotation.
Comment 1 sasha.libreoffice 2012-04-02 07:10:32 UTC
Thanks for new idea. I agree with it.
Please, attach odg document with few objects that demonstrates that current situation is not handy (productivity is low)

Another idea: option to align objects to grid not by outer bounding lines, but by glue points.
Comment 2 Joel Madero 2012-07-03 10:47:25 UTC
Marking as NEEDINFO until attachment(s) is/are provided. Seems like a valid point just want an attachment to see the current behavior and how it's so difficult. Thanks for the suggestion. Once an attachment is made please reopen the bug as UNCONFIRMED and we'll assign it. Thanks again!
Comment 3 sasha.libreoffice 2012-07-06 05:56:23 UTC
Created attachment 63888 [details]
possible example
Comment 4 sergio.callegari 2012-07-06 08:03:36 UTC
Thinking back to this issue, as an alternative to the anchor point (which requires some element of user interface) a cheaper solution could be to at least store the current offset from the grid (x and y distance of the top left corner to the object relative to the closest point on grid) when moving the objects to the gallery. And restoring this offset when moving the object from the gallery to a drawing.

In this way, as long as the grid is not changed, the object maintains its relative position to the grid.

BTW, with regards to the grid, in this moment the most serious issue is that about copying and pasting objects with line width > 0 which loose their position relative to the grid (44990)
Comment 5 QA Administrators 2013-05-26 22:32:17 UTC Comment hidden (obsolete)
Comment 6 sergio.callegari 2013-05-30 09:34:27 UTC
Created attachment 80021 [details]
Tet case
Comment 7 sergio.callegari 2013-05-30 09:38:24 UTC
Please try with the "Test case file".

1) Open the file
2) See the blue box. Note that it is grid-aligned (on a metric grid).
3) Open the gallery, create a new theme (or select an existing one, say "My theme")
4) Click on the blue box and keep the mouse button pressed, until the cursor changes, drag the object into the gallery, see the object appearing in the gallery
5) Click on the blue box in the gallery and drag it to the drawing area. Now there are two blue boxes in the drawing area, but the new one is likely not to be grid aligned (and needs manual alignment, selecting position and size and fixing the position).
Comment 8 sasha.libreoffice 2013-05-30 09:52:15 UTC
Thanks for additional information. Here I will describe how I understand problem:
When we move an object from Gallery to document, we see only specific mouse cursor with plus sign. We do not see object itself and aligning not working. Therefore we can not place object correctly from first attempt. And we need select freshly dropped object each time and realign it. It reduces productivity.
And how it should be: object should seen during dropping from Gallery. Not only mouse cursor. And aligning also should work during dropping object. And not only after re-selecting dropped object.

Is this understanding of problem correct?
Comment 9 sergio.callegari 2013-05-30 10:15:46 UTC
IMHO it is a bit more than just:

"object should [be] seen during dropping from Gallery. Not only mouse cursor. And aligning also should work during dropping object. And not only after re-selecting dropped object."

It is:

"object stored in the gallery should remember its offset from the grid, so that when it is taken out of the gallery and dropped in the drawing area it realigns with the same offset" - or - "object should have an anchor point, so that when it is taken out of the library, the anchor point is automatically grid aligned".

Why is this different:

The image in the test case is a rectangle. When it is aligned to the grid, all its corners are aligned. This is a simple case, for which your take is enough. However, you might have more complicated cases. Suppose that you have a triangle where the center of mass must stay aligned to the grid, but the shape is irregular, such that none of its vertexes are grid aligned when the center of mass is aligned. Showing the object while dropping it is not enough to deal with this case, unless there is an explicit anchor point at the centre of mass, or unless the original offset to the grid of the top left point of the object is stored with it in the gallery, so that it can be automatically recoverd.
Comment 10 sergio.callegari 2013-05-30 10:21:40 UTC
Created attachment 80029 [details]
More difficult test case
Comment 11 sergio.callegari 2013-05-30 10:23:12 UTC
As a further example, consider the "More difficult test case"

Here, you have a rectangle, with a red cross inside. The red cross is grid aligned (on a metric grid). Put that in the gallery. Take it out of the gallery and assure that the red cross remains aligned.

This is tricky, since when the red cross is aligned, the corners of the rectangle are not.
Comment 12 sasha.libreoffice 2013-05-30 10:29:15 UTC
I think we have enough information for changing status to NEW
Comment 13 Heiko Tietze 2016-05-04 13:51:02 UTC
While it would be nice to drag the actual symbol/stencil/image from the gallery instead of showing a drag cursor would be nice I disagree with the closer association of objects and alignment. I mean adding a "hotspot" just for sake of better placement makes no sense. Keep also in mind that the gallery holds various objects and is available not only in Draw.

But again, showing a real drag image would be an advantage and might be easy to implement. Could be an EASYHACK with middle difficulty.
Comment 14 jani 2016-05-04 14:17:54 UTC
Sounds like an easyHack, but it misses:
- codepointers (mandatory for easyHack)
- set the keyword skill<foo> and difficulty<foo>
- Optionally also set topic<foo>

Marking it as "NEEDING" for now.
Comment 15 sergio.callegari 2016-05-04 14:42:49 UTC
Please, do not change my wishlist item to something else.

My wishlist item is having something to favor the grid alignment of objects taken from the gallery. This is important (almost indispensable) for activities like technical drawing or chart drawing.

Being able to visualize the objects taken out of the gallery during drag can be quite nice, but is not what I was asking in this wishlist item and does not help in this sense.


 Even if draw is not a program for technical drawing or chart drawing, it is my understanding that it aims at being sufficiently general purpose for these tasks (the availability of items such as layers, connectors and measurement lines appear to testify that this is the case).

In some forms of technical/chart drawing you need to compose designs out of items/blocks that are taken out of a library and these items need to be carefully aligned before they are connected, otherwise the connectors get all sort of ugly skews and angles.

Already, there are many users of libreoffice who employ it for drawing things like simple electrical or electronic circuits, simple sets of mechanical, hydraulic or fluid-dynamics blocks as well as simple charts, particularly in education, relying on libraries of blocks stored as gallery themes. For instance, see the LibreSymbols extension with electronic symbols (http://extensions.libreoffice.org/extension-center/libresymbols), or the Openoffice extension http://extensions.services.openoffice.org/project/freie-schaltzeichen, or the many questions like https://ask.libreoffice.org/en/question/2996/electrical-and-fluid-schematic-palettestemplates/ or tutorials like http://www.atlence.com/tips/show/creating-electronic-circuit-schematics-by-using-libreoffice-or-openoffice-org-5.html. Libreoffice itself provides themes of flow chart and diagram components!

Having to manually fix the correct alignment for many tens of items is extremely cumbersome, particularly if the items have irregular shapes so that putting their left/right/top/bottom edge on grid is not enough. In this case, one needs to open the position properties dialog for each object, which is a pain.

Please, be understanding and do not dismiss something as "making no sense" just because you do not have a need for it. Others may have.

Possible implementation:

a) Objects, including group objects already provide the opportunity of having glue points. When an object is stored in the gallery, its glue points are stored with the object. Let one glue point be marked as the object "orgin"

b) When extracting objects from the gallery assure that whenever the object contains a glue point marked as the origin and "snap to grid is on" this special glue point is grid aligned

This should minimize the implementation cost and makes sense because when you draw diagram like structures, you almost certainly want some of your glue points grid aligned (see rationale above).

Furthermore, this suggestions does not interfere with the fact that the gallery can hold various object types and is available not only in Draw, since gallery objects store their glue points already.
Comment 16 Buovjaga 2016-05-18 09:15:32 UTC
*** Bug 92604 has been marked as a duplicate of this bug. ***
Comment 17 Heiko Tietze 2016-05-25 10:59:51 UTC
(In reply to sergio.callegari from comment #15)

> My wishlist item is having something to favor the grid alignment of objects
> taken from the gallery. This is important (almost indispensable) for
> activities like technical drawing or chart drawing.

True, that's a different question. I suggest to use the protection flag (position and/or size), and just store this at the gallery. 

Not an EASYHACK anymore since we need to change the format of gallery objects.
Comment 18 sergio.callegari 2016-05-25 18:14:38 UTC
Thanks for recognizing the value of the wish!

Can you please provide a quick illustration of how you intend the use of the stored "protect position" flag as an alternative to the "one glue point as an anchor point" suggestion?
Comment 19 Heiko Tietze 2016-05-26 09:37:52 UTC
(In reply to sergio.callegari from comment #18)
> Can you please provide a quick illustration of how you intend the use of the
> stored "protect position" flag as an alternative to the "one glue point as
> an anchor point" suggestion?

Your feature request is to place gallery objects at a fix position, with the use case to create more than one page with static objects. That's a valid request and would be a valuable enhancement.

The solution is up to the developers. Glue points are used for connectors not to store positional information. So my suggestion is just another idea: objects that have set the protection flag should keep it at the gallery. Quite simple from the usability POV.

The real problems are on the implementation side. Additonally to the question how to store any flag, Draw doesn't start dragging for protected objects, neither for short nor long click, while Writer just don't accept protected drag objects. And we need a common approach. And once we have the exact position stored how should the process work when this sticky object is dragged from the gallery? I'd say like any other with the exception that from any point where it is dropped the object snaps to its fix origin.

Besides all these questions I think it would be consistent and comfortable to see the drag image even when started from the gallery.
Comment 20 sergio.callegari 2016-05-28 16:03:35 UTC

thanks for the clarification. I was asking precisely because there may be different ways to address the enhancement request and developers may get insight from a discussion where the possible use cases and envisaged solutions are explicitly illustrated. In fact, this may help identifying the solution that could address the needs of the widest possible basin of users.

What is unclear to me about the storage of the "protected position" flag is whether you mean this to be stored together with the original position of the object before it is placed in the theme gallery.

Would that mean that when an object is taken out of the gallery it would go to that position and require the user to disable the protected position flag to move it elsewhere?  This would be inconvenient. When one takes objects out of a library of parts, these need to be placed in various positions. 

For instance, consider the already existing extensions providing electronic components, logic gates, symbols for mechanical and hydraulic drawings, etc. Let's focus on the logic gate case just to pick one. A drawing containing logic gates may need to contain tens of "2 input AND gates" each in a different position (and then tens of "OR gates", etc...), yet each with their terminals grid aligned, so that when connectors are used to link them, the connectors don't get funny skews and angles.

Hence, I just wanted to check that you properly considered placing many identical objects at different places yet each with grid alignment with minimal overhead.

In any case, thanks for the effort in trying to enlarge the spectrum of ideas to address the enhancement request, which can indeed be useful.
Comment 21 Thomes tout 2019-01-29 18:24:32 UTC Comment hidden (spam)
Comment 22 Fisto Victor 2019-01-29 23:16:05 UTC Comment hidden (spam)
Comment 23 Winsel Thomas 2019-01-31 19:50:06 UTC Comment hidden (spam)
Comment 24 Iguru Services 2019-03-18 09:41:50 UTC Comment hidden (spam)
Comment 25 Andy James 2019-07-16 21:01:06 UTC Comment hidden (spam)
Comment 26 andreas_k 2020-04-03 19:59:30 UTC

the new (LibreOffice 7.0) gallery items will follow the default grid so that this bug will be fixed.