[Libreoffice-ux-advise] [Bug 157945] UI: Resizing of a selection of columns/rows should correspond to the mouse position

bugzilla-daemon at bugs.documentfoundation.org bugzilla-daemon at bugs.documentfoundation.org
Thu Nov 16 21:56:13 UTC 2023


https://bugs.documentfoundation.org/show_bug.cgi?id=157945

--- Comment #5 from Henrik Gebauer <code at henrik-gebauer.de> ---
Thanks for having a look at this. 

My most typical use case is this: I have a table and want to print it or export
to PDF and want it to take up the whole width of a single page. The columns do
not have the same widths because some contain labels and other contain single
digits. I want to resize SOME of the columns so the width of the table matches
the width of the page. Small columns should stay small and wide columns should
stay wide. But most of all I would like to see in advance (before the mouse
button is released) how wide the whole selection will be afterwards.

(In reply to Heiko Tietze from comment #3)
> Assuming we implement the suggested
> variant, eg. enabled per modifier key, how would the procedure deal with
> some other column/row than the last? For example, you select A:E and resize
> on C.

What would feel most natural for me would be: The right edge of C would stay
where you release the mouse button, D:E will resize by the same factor.

In peudo-code it should be like this:

void handleMousePointerRelease() {
  int difference = mousePointer.xPostionNow - mousePointer.xPositionBefore;

  int oldWidth = 0;
  foreach (col in currentTable.getAllColumns()) {
    if (col.right > xStart) {
      break;
    }
    if (col.isSelected) {
      oldWidth += col.width;
    }
  }

  double factor = (oldWidth + difference) / oldWidth;

  foreach (col in currentTable.getAllColumns()) {
    if (col.isSelected) {
      col.width *= factor;
    }
  }
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Libreoffice-ux-advise mailing list