Project

General

Profile

Actions

Bug #14527

open

WGridLayout with re-sizable row/column has inconsistent handling of RESIZE_HANDLE_MARGIN

Added by Will Johnson 10 days ago. Updated 2 days ago.

Status:
Review
Priority:
Low
Assignee:
-
Target version:
Start date:
05/12/2026
Due date:
% Done:

0%

Estimated time:

Description

When a WGridLayout has any row (or column) marked resizable via setRowResizable() / setColumnResizable(), the layout reserves more total margin in its measure pass than its position pass actually consumes.
Each resize handle leaks RESIZE_HANDLE_MARGIN (= 5 px) of space, which manifests as a gap between the last cell and the layout container's trailing edge.

In src/js/StdGridLayoutImpl2.js:
Around line 783, each resizable row gets 2 * RESIZE_HANDLE_MARGIN margin reserved for not-the-first-row, eg.

  totalMargin += DC.margins[SPACING];
  if (rh) {
    totalMargin += RESIZE_HANDLE_MARGIN * 2;        // 10 px
  }

But in the position pass, around line 1494:

if (resizeHandle) {
...
  left += DC.margins[SPACING] / 2;
  setCss(handle, DC.left, left + "px");
  left += RESIZE_HANDLE_MARGIN;
}
...
else if (resizeHandle) {
  left += DC.margins[SPACING] / 2;                // 2.5
}

This results in an extra RESIZE_HANDLE_MARGIN after the last element.

I think just changing totalMargin += RESIZE_HANDLE_MARGIN * 2; to totalMargin += RESIZE_HANDLE_MARGIN; should fix this - and I think the column logic would need a similar fixup.

For the meantime, this can be compensated for by setting a wtGetPS JS member of the layout container, of:

  container->setJavaScriptMember( "wtGetPS",
    "function(c,w,d,r){"
      "if(d!==1)return 0;"
      "return -5 * w.querySelectorAll(':scope > .Wt-hrh2').length;"
    "}" );

(.Wt-vrh2 for the horizontal-direction case.)

Actions #1

Updated by Romain Mardulyn 2 days ago

  • Assignee set to Romain Mardulyn
Actions #2

Updated by Romain Mardulyn 2 days ago

  • Status changed from New to InProgress
Actions #3

Updated by Romain Mardulyn 2 days ago

  • Target version set to 4.13.3
Actions #4

Updated by Romain Mardulyn 2 days ago

  • Status changed from InProgress to Review
  • Assignee deleted (Romain Mardulyn)
Actions

Also available in: Atom PDF