Bug 159562 - Image size: activate "Relative to" when inputting percentages
Summary: Image size: activate "Relative to" when inputting percentages
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: UI (show other bugs)
Version:
(earliest affected)
7.6.4.1 release
Hardware: x86-64 (AMD64) All
: medium enhancement
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Image-Dialog
  Show dependency treegraph
 
Reported: 2024-02-05 09:38 UTC by luc0x61
Modified: 2024-02-23 09:37 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments
Short test document (14.51 KB, application/octet-stream)
2024-02-05 09:41 UTC, luc0x61
Details

Note You need to log in before you can comment on or make changes to this bug.
Description luc0x61 2024-02-05 09:38:10 UTC
Description:
Opening the image properties dialog for an inserted external image (key F4) is often misleading with settings.
a. When selecting the main position and dimensioning tab, values entered can give unexpected results: entering a percentage (without a "relative" flag set) instead of a dimension produces a strange effect. As an example, with a 3.86 cm wide image, entering "50%" results in a 21.0 cm wide image
b. The results in the cropping tab are completely astray from what the "keep proportions"/"keep dimensions" selection suggests: Even with "keep proportions" flagged, the width/height percentages/dimensions can be set to any non-proportional value. Even worse if you "substitute" an image (from the contextual menu with a right-click on the image), as it retains the old percentages.
c. Different proportions on imported vectorial images, containing an unknown font, may even result in a catastrophic final effect on screen rendered image (text doesn't scale proportionally in the two directions, with unexpected overflows)


Steps to Reproduce:
1. I created a simple diagram with yED and exported it to SVG; this tests the unknown fonts, as it forcibly uses "Dialog", which isn't present on my system
2. Import the SVG image
3. Select the image and open it with F4 image settings
4. Fiddle with settings as described above

Actual Results:
An unexpected percentage entered produces a weird change in dimensions.
There's no automatic proportional resize in percentage.
Unproportional resizing fails to render correctly fonts in vectorial images.


Expected Results:
If a percentage has no clear meaning in a field value, then it should be unacceptable as a value or have a clearer effect (e.g. affecting the dimension itself).
Proportional resize could result in a proportional resize, that would make sense.
Font resizing in vectorial images should follow the proportion of the rest of the image.


Reproducible: Always


User Profile Reset: No

Additional Info:
Version: 7.6.4.1 (X86_64) / LibreOffice Community
Build ID: e19e193f88cd6c0525a17fb7a176ed8e6a3e2aa1
CPU threads: 12; OS: Windows 10.0 Build 22631; UI render: default; VCL: win
Locale: it-IT (it_IT); UI: it-IT
Calc: threaded

Note also that this behavior is the same with version 24.2.0.3
Comment 1 luc0x61 2024-02-05 09:41:06 UTC
Created attachment 192402 [details]
Short test document
Comment 3 luc0x61 2024-02-05 15:19:29 UTC
@m_a_riosv That would be fine. However, a % is accepted anyway, with the weird behavior that you can see for yourself (pressing Tab or Enter, after filling the field with something as "50%")
Comment 4 Buovjaga 2024-02-22 14:21:42 UTC
(In reply to luc0x61 from comment #3)
> @m_a_riosv That would be fine. However, a % is accepted anyway, with the
> weird behavior that you can see for yourself (pressing Tab or Enter, after
> filling the field with something as "50%")

It is not really accepted, but ignored. When you enter 50%, it thinks you want to make it 50 cm wide and caps it at 21 cm, the page width.

It seems intuitive to automatically activate "Relative to" when percentages have been input, but let's confirm with UX team.
Comment 5 Heiko Tietze 2024-02-23 09:37:09 UTC
And if "[x] Relative" is checked a string like "10 cm" makes it an absolute parameter? And how about inch, km, px, foo... I proposed some kind of unit switch control-side in bug 72662 but this dialog is a bit of a stretch.

We could also just not accept invalid input (units, comma, separators...), or have an extra spin edit for this type like

Width: (o) absolute [    ] cm
       ( ) relative [    ] %
           to [Entire paragraph area]

But since absolute and relative values are converted when clicking the '[ ] Relative to' option, I can follow the idea of auto-checking if % is part of the string. If the checkbox is checked a plain value would be treated as percent, any other text (2cm, 5in, 7foo) makes it an absolute value, ie. the '[ ] Relative to' is automatically unchecked.