Bug 428815 - "%" in "Scale Layer to new Size" indicates an unexpected value
Summary: "%" in "Scale Layer to new Size" indicates an unexpected value
Status: RESOLVED INTENTIONAL
Alias: None
Product: krita
Classification: Applications
Component: General (other bugs)
Version First Reported In: 4.4.1
Platform: Appimage Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-11-08 03:43 UTC by fsqrt
Modified: 2020-11-09 17:32 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fsqrt 2020-11-08 03:43:22 UTC
SUMMARY
In "Scale Layer to new Size", if I try to scale a layer in percentage, I have to enter the ratio of the layer size to the entire image (I want to scale it as a percentage of the original layer size).

STEPS TO REPRODUCE
1. create a new document
2. add a paint layer and draw something on it (do not fill the entire image)
3. go to "Layer" -> "Transform" -> "Scale Layer to new Size"
4. change size unit to "%"

OBSERVED RESULT
The percentage value is the ratio of the layer size to the image size.

EXPECTED RESULT
The percentage value is the ratio of layer after scaling to the original layer size (default value is 100%).

SOFTWARE/OS VERSIONS
Krita
  Version: 4.4.1

Qt
  Version (compiled): 5.12.9
  Version (loaded): 5.12.9

OS Information
  Build ABI: x86_64-little_endian-lp64
  Build CPU: x86_64
  CPU: x86_64
  Kernel Type: linux
  Kernel Version: 5.4.0-52-generic
  Pretty Productname: Ubuntu 20.04.1 LTS
  Product Type: ubuntu
  Product Version: 20.04
Comment 1 Dmitry Kazakov 2020-11-09 08:47:10 UTC
Hi, fsqrt!

To scale relative to image size you should use "vw" and "vh" units. Percentage is always relative to the current size of the layer.
Comment 2 fsqrt 2020-11-09 17:10:33 UTC
Thank you for your comment.

I know developers are very busy, but I would appreciate it if you could go over the report again.
I am not asking how to scale the layers


Yes, users will think as you said, Percentage is always relative to the current size of the layer (as well as Transform tool). but it isn't.


If we select the unit in '(QComboBox*)WdgLayerSize::newWidthUnit/newHeightUnit', end up with 'KisDocumentAwareSpinBoxUnitManager::getConversionFactor()'.


  qreal KisDocumentAwareSpinBoxUnitManager::getConversionFactor(int dim, QString psymbol) const
  {
      QString symbol = psymbol;

      if (symbol == "%") { //percent can be seen as vw or vh depending of the reference side in the image.
          if (pixDir == PIX_DIR_X) {
              symbol = "vw";
          } else {
              symbol = "vh";
          }
      }
      ...


Unit symbol "%" will override "vw"/"vh". "vw"/"vh" refers to image size, not layer. I think this is bug.
Comment 3 fsqrt 2020-11-09 17:32:23 UTC
-  Unit symbol "%" will override "vw"/"vh".
+  Unit symbol "%" will be overwritten by "vw"/"vh".