Bug #14527
closedWGridLayout with re-sizable row/column has inconsistent handling of RESIZE_HANDLE_MARGIN
0%
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.
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
- Assignee set to Romain Mardulyn
RM Updated by Romain Mardulyn 3 months ago
- Status changed from New to InProgress
RM Updated by Romain Mardulyn 3 months ago
- Target version set to 4.13.3
RM Updated by Romain Mardulyn 3 months ago
- Status changed from InProgress to Review
- Assignee deleted (
Romain Mardulyn)
MV Updated by Matthias Van Ceulebroeck 3 months ago
- Assignee set to Matthias Van Ceulebroeck
RM Updated by Romain Mardulyn 3 months ago
- Status changed from Review to Implemented @Emweb
- Assignee changed from Matthias Van Ceulebroeck to Romain Mardulyn
RM Updated by Romain Mardulyn 2 months ago
- Status changed from Implemented @Emweb to Closed