Limit column widths to not exceed the total width of the table

A bit clunky, but very effective!

This way we don't have to deal with clipping or scrolling horizontally.

Contributes to issue CURA-8686.
This commit is contained in:
Ghostkeeper 2022-01-25 18:31:43 +01:00
parent 279c23f5aa
commit 2429f28b7f
No known key found for this signature in database
GPG key ID: D2A8871EE34EC59A

View file

@ -80,6 +80,15 @@ Item
if(drag.active)
{
parent.parent.width = Math.max(10, parent.parent.width + mouseX); //Don't go smaller than 10 pixels, to make sure you can still scale it back.
let sum_widths = 0;
for(let i = 0; i < headerBar.children.length; ++i)
{
sum_widths += headerBar.children[i].width;
}
if(sum_widths > tableScrollView.width)
{
parent.parent.width -= sum_widths - tableScrollView.width; //Limit the total width to not exceed the view.
}
}
tableView.forceLayout();
}