Skip to content

Commit

Permalink
jsonnetfmt
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wilkie <[email protected]>
  • Loading branch information
tomwilkie committed Sep 6, 2021
1 parent e1d999e commit 3521d13
Showing 1 changed file with 31 additions and 31 deletions.
62 changes: 31 additions & 31 deletions grafonnet-7.0/layout.libsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,38 @@
// .addPanel(...)

{
// Track where the next panel should go using these private variables, aka "the cursor".
_cursor:: {
x: 0,
y: 0,
h: 0,
},
// Track where the next panel should go using these private variables, aka "the cursor".
_cursor:: {
x: 0,
y: 0,
h: 0,
},

// addPanels add a panel at the cursor and moves the cursor to the right by the panel width.
addPanel(panel)::
local cursor = self._cursor;
local panelWithPos = panel {
gridPos+: {
x: cursor.x,
y: cursor.y,
},
};
super.addPanel(panelWithPos) + {
_cursor+:: {
x+: panel.gridPos.w,
h:
if cursor.h > panel.gridPos.h
then cursor.h
else panel.gridPos.h,
},
},
// addPanels add a panel at the cursor and moves the cursor to the right by the panel width.
addPanel(panel)::
local cursor = self._cursor;
local panelWithPos = panel {
gridPos+: {
x: cursor.x,
y: cursor.y,
},
};
super.addPanel(panelWithPos) + {
_cursor+:: {
x+: panel.gridPos.w,
h:
if cursor.h > panel.gridPos.h
then cursor.h
else panel.gridPos.h,
},
},

// Start a new row beneath the current cursor.
nextRow():: self + {
_cursor+:: {
x: 0,
y+: super.h,
h: 0,
},
// Start a new row beneath the current cursor.
nextRow():: self + {
_cursor+:: {
x: 0,
y+: super.h,
h: 0,
},
},
}

0 comments on commit 3521d13

Please sign in to comment.