Project

General

Profile

Actions

Bug #14527

closed
WJ RM

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

Bug #14527: WGridLayout with re-sizable row/column has inconsistent handling of RESIZE_HANDLE_MARGIN

Added by Will Johnson 4 months ago. Updated 2 months ago.

Status:
Closed
Priority:
Low
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.)

RM Updated by Romain Mardulyn 3 months ago Actions #1

  • Assignee set to Romain Mardulyn

RM Updated by Romain Mardulyn 3 months ago Actions #2

  • Status changed from New to InProgress

RM Updated by Romain Mardulyn 3 months ago Actions #3

  • Target version set to 4.13.3

RM Updated by Romain Mardulyn 3 months ago Actions #4

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

MV Updated by Matthias Van Ceulebroeck 3 months ago Actions #5

  • Assignee set to Matthias Van Ceulebroeck

RM Updated by Romain Mardulyn 3 months ago Actions #6

  • Status changed from Review to Implemented @Emweb
  • Assignee changed from Matthias Van Ceulebroeck to Romain Mardulyn

RM Updated by Romain Mardulyn 2 months ago Actions #7

  • Status changed from Implemented @Emweb to Closed
Actions

Also available in: PDF Atom