Differences From
Artifact [08cb8bbbbd]:
- File
mods/starlit/ui.lua
— part of check-in
[953151446f]
at
2024-05-05 19:31:39
on branch trunk
— better alarm LEDs, continue work on matter compiler UI, hack around gravitational horrorscape (i.e. stop shitting all over the server's `minetest.conf`), better stat interface, tweak some compute stats, be more generous with starting battery loadout, mercilessly squash numberless bugs beneath my jackbooted heel
(user:
lexi,
size: 9984)
[annotate]
[blame]
[check-ins using]
150 150 widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
151 151 -- TODO alignments
152 152 state.x=state.x + state.spacing + st.w
153 153 state.h = math.max(state.h, st.h)
154 154 end
155 155 state.h = state.h + state.padding
156 156 state.w = state.x + state.padding/2
157 + elseif def.kind == 'hwrap' then
158 + local idx, rowH, totalH = 0,0,0
159 + local cols = def.cols or math.huge
160 + local startX = state.x
161 + local maxX = startX
162 + for _, w in ipairs(def) do idx = idx + 1
163 + local src, st = starlit.ui.build(w, state)
164 + -- TODO alignments
165 + rowH = math.max(rowH, st.h)
166 + if idx > cols or def.w and (state.x + state.spacing + st.w > def.w) then
167 + totalH = totalH + rowH
168 + state.x = startX
169 + rowH,idx = 0,0
170 + state.y = state.y + state.spacing + st.h
171 + end
172 + widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
173 + state.x=state.x + state.spacing + st.w
174 + maxX = math.max(state.x, maxX)
175 + end
176 + totalH = totalH + rowH
177 + state.h = math.max(state.h, totalH) + state.padding
178 + state.w = state.x + state.padding/2
179 + state.x = maxX
157 180 elseif def.kind == 'pane' then
158 181 widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
159 182 state.x, state.y, state.w, state.h,
160 183 def.id)
161 184 local y = 0
162 185 for _, w in ipairs(def) do
163 186 local src, st = starlit.ui.build(w, state)