starlit  Diff

Differences From Artifact [5149fd5b74]:

To Artifact [60598b98d5]:


   176    176   			maxX = math.max(state.x, maxX)
   177    177   		end
   178    178   		totalH = totalH + rowH
   179    179   		state.h = math.max(state.h, totalH) + state.padding
   180    180   		state.w = state.x + state.padding/2
   181    181   		state.x = maxX
   182    182   	elseif def.kind == 'pane' then
          183  +		local top = state.y
   183    184   		widget('scroll_container[%s,%s;%s,%s;%s;vertical]',
   184    185   			state.x, state.y, state.w, state.h,
   185    186   			def.id)
   186    187   		local y = 0
          188  +		local x,w = state.x,state.w
          189  +-- 		state.x = state.x + .75
          190  +-- 		state.w = state.w - .75
          191  +		local widgs = {}
   187    192   		for _, w in ipairs(def) do
   188    193   			local src, st = starlit.ui.build(w, state)
   189         -			widget('container[%s,%s]%scontainer_end[]', 0, y, src)
          194  +			table.insert(widgs, {
          195  +				y=y, src=src
          196  +			})
   190    197   			y=y + state.spacing + st.h
   191    198   			state.w = math.max(state.w, st.w)
   192    199   		end
          200  +		local xo, barred = 0, false
          201  +		if y-top > state.h then
          202  +			barred, xo = true, .60
          203  +		end
          204  +		for k,v in ipairs(widgs) do
          205  +			widget('container[%s,%s]%scontainer_end[]', xo, v.y, v.src)
          206  +		end
   193    207   		widget('scroll_container_end[]')
   194         -		if y > state.h then
   195         -			widget('scrollbar[%s,%s;%s,%s;vertical;%s;]',
   196         -				state.x, state.y, .5, state.h,
          208  +		if barred then
          209  +			widget('scrollbaroptions[max=%s]scrollbar[%s,%s;%s,%s;vertical;%s;]',
          210  +				(y-top-state.h)*10, x, state.y, .5, state.h,
   197    211   				def.id)
   198    212   		end
   199         -		state.w = state.w + state.padding
          213  +		state.x = x
          214  +		state.w = w + state.padding
   200    215   		state.h = state.h + state.padding/2
          216  +		state.y = state.y + state.h
   201    217   	elseif def.kind == 'list' then
   202    218   		local slotTypes = {
   203    219   			plain = {hue = 200, sat = -.1, lum = 0};
   204    220   -- 			element = {hue = 20, sat = -.3, lum = 0};
   205    221   			chip = {hue = 0, sat = -1, lum = 0};
   206    222   -- 			psi = {hue = 300, sat = 0, lum = 0};
   207    223   			power = {hue = 50, sat = 0, lum = .2};
................................................................................
   323    339   	if def.mode or def.container then
   324    340   		if def.mode then
   325    341   			l = string.format('background9[%s,%s;%s,%s;%s;false;64]',
   326    342   					originX, originY, state.w, state.h,
   327    343   					E(string.format('starlit-ui-bg-%s.png%s^[resize:128x128',
   328    344   						(def.mode == 'sw') and 'digital'
   329    345   											or 'panel', cmod))) .. l
          346  +--  			l = string.format('style_type[scrollbar;bgcolor=#1155ff]') .. l
   330    347   		end
   331    348   		if parent == nil or state.color ~= parent.color then
   332    349   			l = btnColorDef() .. l
   333    350   		end
   334    351   	end
   335    352   	if not parent then
   336    353   		return string.format('formspec_version[6]size[%s,%s]%s', state.w, state.h, l), state