Docking issues when layoutContainer is at a offset

Author: mel-coCreated Jan 29, 2025Updated Jan 29, 2025

I noticed in the Dynamically adding Components Tutorial as well as on my Website (which also has a menuContainer to the left), that it is not possible to dock to the left.

After some investigation I noticed that the itemArea with side=x2 has false coordinates. The areas x2 value is always 50 even though x1 may be larger.

I was able to somewhat fix it with the following code

javascript
myLayout.on( 'stateChanged', function(){
    myLayout._itemAreas.forEach((area) => {
        if(area.side === "x2")
            area.x2 = area.x1 + 50;
    })
});

Source: golden-layout/golden-layout