File tree Expand file tree Collapse file tree
src/mudlet-lua/lua/geyser Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626-- Called when a new element is added
2727function Geyser .HBox :organize ()
2828 self .parent :reposition ()
29+ -- Workaround for issue with width/height being 0 at creation
30+ if self :get_width () == 0 then
31+ self :resize (" 0.9px" , nil )
32+ end
33+ if self :get_height () == 0 then
34+ self :resize (nil , " 0.9px" )
35+ end
2936 local window_width = (self :calculate_dynamic_window_size ().width / self :get_width ()) * 100
3037 local start_x = 0
3138 for _ , window_name in ipairs (self .windows ) do
@@ -40,7 +47,7 @@ function Geyser.HBox:organize()
4047 height = 100
4148 end
4249 window :resize (width .. " %" , height .. " %" )
43- start_x = start_x + ( window : get_width () / self : get_width ()) * 100
50+ start_x = start_x + width
4451 end
4552end
4653
@@ -65,12 +72,4 @@ function Geyser.HBox:new2 (cons, container)
6572 cons .useAdd2 = true
6673 local me = self :new (cons , container )
6774 return me
68- end
69-
70- --- Overridden constructor to use add2
71- function Geyser .HBox :new2 (cons , container )
72- cons = cons or {}
73- cons .useAdd2 = true
74- local me = self :new (cons , container )
75- return me
76- end
75+ end
Original file line number Diff line number Diff line change 2727-- Called when a new element is added
2828function Geyser .VBox :organize ()
2929 self .parent :reposition ()
30-
31- local window_height = (self :calculate_dynamic_window_size ().height / self .get_height ()) * 100
30+ -- Workaround for issue with width/height being 0 at creation
31+ if self :get_width () == 0 then
32+ self :resize (" 0.9px" , nil )
33+ end
34+ if self :get_height () == 0 then
35+ self :resize (nil , " 0.9px" )
36+ end
37+ local window_height = (self :calculate_dynamic_window_size ().height / self :get_height ()) * 100
3238 local start_y = 0
3339 for _ , window_name in ipairs (self .windows ) do
3440 local window = self .windowList [window_name ]
@@ -42,7 +48,7 @@ function Geyser.VBox:organize()
4248 height = window_height * window .v_stretch_factor
4349 end
4450 window :resize (width .. " %" , height .. " %" )
45- start_y = start_y + ( window : get_height () / self : get_height ()) * 100
51+ start_y = start_y + height
4652 end
4753end
4854
@@ -66,4 +72,4 @@ function Geyser.VBox:new2 (cons, container)
6672 cons .useAdd2 = true
6773 local me = self :new (cons , container )
6874 return me
69- end
75+ end
You can’t perform that action at this time.
0 commit comments