starlit  Diff

Differences From Artifact [60598b98d5]:

To Artifact [a436d8c893]:


   161    161   		local cols = def.cols or math.huge
   162    162   		local startX = state.x
   163    163   		local maxX = startX
   164    164   		for _, w in ipairs(def) do idx = idx + 1
   165    165   			local src, st = starlit.ui.build(w, state)
   166    166   			-- TODO alignments
   167    167   			rowH = math.max(rowH, st.h)
   168         -			if idx > cols or def.w and (state.x + state.spacing + st.w > def.w) then
          168  +			if idx > cols or (def.w and (state.x + state.spacing + st.w > def.w)) then
   169    169   				totalH = totalH + rowH
   170    170   				state.x = startX
   171    171   				rowH,idx = 0,0
   172    172   				state.y = state.y + state.spacing + st.h
   173    173   			end
   174    174   			widget('container[%s,%s]%scontainer_end[]', state.x, state.y, src)
   175    175   			state.x=state.x + state.spacing + st.w
................................................................................
   289    289   		widget('label[%s,%s;%s]',
   290    290   			state.x, state.y + def.h*.5, txt)
   291    291   	elseif def.kind == 'text' then
   292    292   		-- TODO paragraph formatter
   293    293   		widget('hypertext[%s,%s;%s,%s;%s;%s]',
   294    294   			state.x, state.y, def.w, def.h, E(def.id), E(def.text))
   295    295   	elseif def.kind == 'hbar' or def.kind == 'vbar' then -- TODO fancy image bars
   296         -		local cl = lib.color(state.color)
          296  +		local cl = lib.color(def.color or state.color)
   297    297   		local fg = state.fg or cl:readable(.8,1)
   298    298   		local wfac, hfac = 1,1
   299    299   		local clamp = math.min(math.max(def.fac or 0, 0), 1)
   300    300   		if def.kind == 'hbar'
   301    301   			then wfac = wfac * clamp
   302    302   			else hfac = hfac * clamp
   303    303   		end