Skip to content

Fix get the next size up or down from ideal

Cycling through sizes does not reach all indexes.

For example, I have:

let SIZES = [
    [ 600,  600], // square
    [ 800,  600], // SVGA  4:3
    [ 800,  800], // square
    [1024,  600], // rectangle
    [1024,  768], // XGA   4:3
    [1024, 1024], // square
    [1200,  600], // rectangle
    [1200,  700], // rectangle
    [1200,  900], // rectangle
    [1280,  720], // WXGA 16:9
    [1280, 1024], // SXGA  5:4
    [1300,  600], // rectangle
    [1366,  768], // HD  ≈16:9
];

When I cycle on a 1366x768 monitor (1366x741 workArea) it only reaches the second size, although the fourth (and others) would fit.

With this fix, the script iterates over sizes, correctly ignoring the ones that would not fit.

Merge request reports