Closed v-zhuravlev closed 1 year ago
Fixed a bug (you can see that test4 comes before test1 ) and added row handling (shift Y when row encountered).
The calculations looks fine, can't find an immediate problem. The code could be a bit more concise and perhaps a few more comments to explain what each if/else statement means in the process (eg. "start of new row as width exceeds gridWidth")
One potential problem: this doesn't take collapsed rows into account. I was looking at
makeGrid
and noticed I've inlined the logic to 'group' panels to their rows instead of making it generally available through a function, might be useful to incorporate that.
Added few more comments to explain main if/else conditionals. As of collapsed rows, I don't quite understand the logic as of now.
This util function can be used to position an array of panels to the grid, without providing
gridPos.x
,gridPos.y
coordinates. Once the total width of panels reaches total length of 24, it wraps to next 'row'.This can serve as an alternative to
makeGrid
, especially if you want to use various width for panels.This function uses
gridPos.h
andgridPos.w
defined in panels by default, and if it is missing, would use panelWidth, panelHeight default values.x
andy
are calculated.Example1:
Example2:
Would generate grid identical to one used in linux overview dashboard: