Bug 149141 - Draw UI/Editing. Allow object creation by clicking if drag size is below threshold
Summary: Draw UI/Editing. Allow object creation by clicking if drag size is below thre...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Draw (show other bugs)
Version:
(earliest affected)
7.4.0.0 alpha0+
Hardware: All All
: medium enhancement
Assignee: AshSinc
URL:
Whiteboard: target:7.4.0
Keywords:
Depends on:
Blocks:
 
Reported: 2022-05-17 21:48 UTC by AshSinc
Modified: 2022-06-13 07:01 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description AshSinc 2022-05-17 21:48:13 UTC
Description:
Create an object of a default size if the user does not specify a size by dragging. Object will be placed centered under the click. 

May be a little more intuitive for new users that expect a mouse-click to place the object. And allows for fast creation of many identically sized objects 
when combined with double click tool selection.

Drag functionality will remain in place.

Steps to Reproduce:
1.Select any shape tool
2.Click and release on the document without dragging

Actual Results:
No object is created

Expected Results:
Object of a default size should be created under cursor


Reproducible: Always


User Profile Reset: No



Additional Info:
Object of a default size should be created under cursor
Comment 1 Buovjaga 2022-05-18 06:23:24 UTC
Let's add design team into the loop.

Btw. you should refer to the bug id in your patch in the form tdf#149141
You can amend your patch https://wiki.documentfoundation.org/Development/gerrit/SubmitPatch#Submitting_a_new_version
Comment 2 Heiko Tietze 2022-05-18 07:42:32 UTC
Do users really expect an object to be created with some default size? Do you have an application in mind that works like that?

Could imagine benefit for accessibility, OTOH. Keyboard only _Insert > _Shape > _Basic Shapes > _Rectangle + F4 (properties) to enter the exact size. Doing so means to loose the Point & Draw functionality - you cannot click the menu item anymore and have either a default size or a mouse interaction.

So my take is to not do it. Little benefit with some costs on consistency comes with high effort. Other ideas?
Comment 3 Regina Henschel 2022-05-18 08:01:08 UTC
"Creation of default shape by single click" is implemented in MS Office and SoftMaker Office. Users coming from these office suites might expect it.

(In reply to Heiko Tietze from comment #2)
> Keyboard only _Insert >
> _Shape > _Basic Shapes > _Rectangle + F4 (properties) to enter the exact
> size.

Do you mean this in F6 keyboard mode? If yes, the proposed additional mouse action would not conflict with the keyboard only workflow.


The proposed patch is in https://gerrit.libreoffice.org/c/core/+/134499
Comment 4 Heiko Tietze 2022-05-18 10:02:07 UTC
Tested the patch and it works like a charm. In fact one has to click twice, first in the menu/toolbar and second at the target position. Unless before the patch, where zero-sized objects got removed, it creates now a shape with 1cm width/height. This is a sensible default and I wouldn't make it variable. And I also wouldn't make this feature optional. So +2 to the patch.

Does not work for 3D objects, lines and polygons, and not at all in Writer.
Comment 5 AshSinc 2022-05-18 14:00:55 UTC
Thanks Buovjaga I'll be sure to add tdf# to the commit message in the next amendment. 

I should point out a couple of things I'm aware of. Grid snapping rules should be followed. So if the user has grid snapping enabled the object should be created centered to the nearest grid rather than the exact click position.

Secondly, in the patch bReturn value will always be true. There is no path where it can be false. I think bReturn represents wether or not the mouse up event has been handled successfully, but also seems to be tied to object creation success. Either way I should check if the default object was created before assigning bReturn to true. This would maintain the same behaviour as before.
Comment 6 AshSinc 2022-05-18 15:51:20 UTC
Ok in latest patch revision the objects now snap to grid if enabled, which feels better. And bReturn can be false if the object is not successfully inserted.

Thanks for testing Heiko Tietze.

I suppose if this was to become a default behaviour then it would make sense that 3D objects, lines, and anything else can follow the same rules.
Comment 7 AshSinc 2022-05-19 22:27:12 UTC
Patch 4 has defaults for Lines/Connectors and 3D objects. The only type missing is freehand Polygons and curves, but because the tool clearly shows a freehand icon by default, I'm not sure how useful it would be to create defaults for any of those.

Having said that I've also got it working in Writer for I think every shape type (even the freehand tools seem to all have a default specified). So it wasn't actually that much work. I haven't submitted the Writer changes yet.  I'm not sure if I should submit as part of the same patch or not.
Comment 8 AshSinc 2022-05-19 22:44:23 UTC
Actually no Writer has defaults for freeform lines, but not polygons or curves. Which makes sense. I'll submit tomorrow to the same patch once I've checked it over.
Comment 9 Heiko Tietze 2022-05-20 07:48:40 UTC
(In reply to AshSinc from comment #7)
> I'm not sure if I should submit as part of the same patch or not.

My take: in case of shared code do one patch, if the modules are completely independent make it two.
Comment 10 AshSinc 2022-05-20 12:26:00 UTC
That sounds like a sensible rule. Ok Writer patch is here : https://gerrit.libreoffice.org/c/core/+/134682

Everything has a default except polygons and curves. There is a little code duplication now. There are a few ways to fix this but I'll leave it open to discuss before doing anything. The only place that the existing CreateDefaultObject() function is used is in /home/ash/projects/libreoffice/sw/source/uibase/uiview/viewdraw.cxx. Although I don't know how this works. In Draw its Ctrl+Click on a tool. In Writer nothing seems to happen.
Comment 11 Commit Notification 2022-05-23 13:10:10 UTC
AshSinc committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/3aa5aa83039b04f1412185e49cad9e3b694d49ca

tdf#149141 - Writer - Added default object creation when drag size too low

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 12 Commit Notification 2022-05-23 13:12:20 UTC
AshSinc committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/9e7597a1cc92e06d61acf87a8c560de3b4fdabf8

tdf#149141 - Added default object creation when drag size too low

It will be available in 7.4.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.