@@ -12,8 +12,11 @@ local makeLocked = function(container)
12
12
end
13
13
local addText = function (container , lines , style )
14
14
local text = color :new ()
15
+ local heights = {0.15 , 0.12 , 0.10 , 0.09 , 0.08 , 0.07 , 0.06 , 0.05 , 0.04 , 0.03 }
16
+ local y = 0
15
17
for i = 0 , lines - 1 do
16
- container :add (layout :newText (" content_text" , 0.02 , i * 0.06 + 0.01 , 0.96 , 0.06 , style , _ (" The quick brown fox jumps over the lazy dog" )))
18
+ container :add (layout :newText (" content_text" , 0.02 , y , 0.96 , heights [1 + i ], style , _ (" The quick brown fox jumps over the lazy dog" )))
19
+ y = y + heights [1 + i ] + 0.01
17
20
end
18
21
return container
19
22
end
@@ -27,8 +30,8 @@ local addButtons = function(container, buttons, percentage, buttonStyle, textSty
27
30
local texts = {_ (" Homepage" ), _ (" About us" ), _ (" Links to us" ), _ (" Privacy" ), _ (" Terms" ), _ (" Contact us" ), _ (" RSS" )}
28
31
for i = 0 , buttons - 1 do
29
32
local button = layout :newFill (" button" , padding , i * size + padding , 1 - padding * 2 , size - padding , buttonStyle [i % styleCount + 1 ])
30
- button :add (makeHelper (layout :newText (" button_text" , 0.25 , 0.65 , 0.5 , 0.3 , textStyle [i % styleTextCount + 1 ], buttonStyle [i % styleCount + 1 ]:label ())))
31
- button :add (layout :newText (" button_text" , 0.25 , 0.25 , 0.5 , 0.5 , textStyle [i % styleTextCount + 1 ], texts [i % # texts + 1 ]))
33
+ button :add (makeHelper (layout :newText (" button_text" , 0.25 , 0.7 , 0.5 , 0.25 , textStyle [i % styleTextCount + 1 ], buttonStyle [i % styleCount + 1 ]:label ())))
34
+ button :add (layout :newText (" button_text" , 0.1 , 0.25 , 0.8 , 0.5 , textStyle [i % styleTextCount + 1 ], texts [i % # texts + 1 ]))
32
35
root :add (button )
33
36
end
34
37
return container
@@ -99,7 +102,7 @@ gpick:addLayout('std_layout_menu_1', _("Menu"), function(system)
99
102
system :setBox (root )
100
103
root :add (addButtons (layout :newFill (" menu" , 0 , 0 , 1 , 1 , styles [' menu' ]), 7 , 1 , { styles [' button' ], styles [' button' ], styles [' button_hover' ] }, { styles [' button_text' ], styles [' button_text' ], styles [' button_text_hover' ] }, 0.1 ))
101
104
end )
102
- gpick :addLayout (' std_layout_grid_1' , _ (" Grid (4x3)" ) , function (system )
105
+ gpick :addLayout (' std_layout_grid_1' , _ (" Grid" ) .. " (4x3)" , function (system )
103
106
local root = layout :newBox (" root" , 0 , 0 , 400 , 300 )
104
107
system :setBox (root )
105
108
for j = 0 , 2 do
@@ -115,7 +118,7 @@ gpick:addLayout('std_layout_grid_1', _("Grid (4x3)"), function(system)
115
118
end
116
119
end
117
120
end )
118
- gpick :addLayout (' std_layout_grid_2' , _ (" Grid (5x4)" ) , function (system )
121
+ gpick :addLayout (' std_layout_grid_2' , _ (" Grid" ) .. " (5x4)" , function (system )
119
122
local root = layout :newBox (" root" , 0 , 0 , 500 , 400 )
120
123
system :setBox (root )
121
124
for j = 0 , 3 do
@@ -131,4 +134,38 @@ gpick:addLayout('std_layout_grid_2', _("Grid (5x4)"), function(system)
131
134
end
132
135
end
133
136
end )
137
+ gpick :addLayout (' std_layout_pie_1' , _ (" Pie chart" ) .. ' 1' , function (system )
138
+ local root = layout :newBox (" root" , 0 , 0 , 400 , 400 )
139
+ system :setBox (root )
140
+ local style = layout :newStyle (" background_b:" .. _ (" Background" ), color :new (0.7 , 0.7 , 0.7 ), 1.0 )
141
+ system :addStyle (style )
142
+ background = layout :newFill (" background" , 0 , 0 , 1 , 1 , style )
143
+ root :add (background )
144
+ local percents = {0.4 , 0.2 , 0.13 , 0.07 , 0.06 , 0.05 , 0.04 , 0.03 , 0.02 }
145
+ local start = - 0.25
146
+ for i , percent in ipairs (percents ) do
147
+ local itemIndex = i
148
+ style = layout :newStyle (" part" .. itemIndex .. " _b:" .. _ (" Part" ) .. " " .. itemIndex , color :new (0.8 - (0.1 * i ), 0.8 , 0.5 - (0.05 * i )), 1.0 )
149
+ system :addStyle (style )
150
+ background :add (layout :newPie (" part" .. itemIndex , 0.05 , 0.05 , 0.9 , 0.9 , start , start + percent , style ))
151
+ start = start + percent
152
+ end
153
+ end )
154
+ gpick :addLayout (' std_layout_pie_2' , _ (" Pie chart" ) .. ' 2' , function (system )
155
+ local root = layout :newBox (" root" , 0 , 0 , 400 , 400 )
156
+ system :setBox (root )
157
+ local style = layout :newStyle (" background_b:" .. _ (" Background" ), color :new (0.7 , 0.7 , 0.7 ), 1.0 )
158
+ system :addStyle (style )
159
+ background = layout :newFill (" background" , 0 , 0 , 1 , 1 , style )
160
+ root :add (background )
161
+ local percents = {0.4 , 0.25 , 0.15 , 0.10 , 0.10 }
162
+ local start = - 0.25
163
+ for i , percent in ipairs (percents ) do
164
+ local itemIndex = i
165
+ style = layout :newStyle (" part" .. itemIndex .. " _b:" .. _ (" Part" ) .. " " .. itemIndex , color :new (0.8 - (0.1 * i ), 0.8 , 0.5 - (0.05 * i )), 1.0 )
166
+ system :addStyle (style )
167
+ background :add (layout :newPie (" part" .. itemIndex , 0.05 , 0.05 , 0.9 , 0.9 , start , start + percent , style ))
168
+ start = start + percent
169
+ end
170
+ end )
134
171
return {}
0 commit comments