@@ -756,7 +756,7 @@ local function reset_view()
756756 bottom = math.mininteger ,
757757 right = math.mininteger
758758 }
759- Init = true
759+ Init = true
760760 update_zoom ()
761761end
762762
@@ -788,15 +788,18 @@ local function get_line_count(str)
788788end
789789
790790local function make_button (x , y , name , func )
791+ local lineCount , longest = get_line_count (name )
791792 local boxWidth = CHAR_WIDTH
792793 local boxHeight = CHAR_HEIGHT
793- local lineCount , longest = get_line_count (name )
794794 local textWidth = longest * CHAR_WIDTH
795795 local textHeight = lineCount * CHAR_HEIGHT
796796 local colors = { 0x66bbddff , 0xaabbddff , 0xaa88aaff }
797797 local colorIndex = 1
798798 local padding = 10
799799
800+ if x < 0 then x = ScreenWidth + x end
801+ if y < 0 then y = ScreenHeight + y end
802+
800803 if textWidth + padding > boxWidth then boxWidth = textWidth + padding end
801804 if textHeight + padding > boxHeight then boxHeight = textHeight + padding end
802805
@@ -919,17 +922,17 @@ local function add_entity(type)
919922end
920923
921924local function make_buttons ()
922- make_button (ScreenWidth - 315 , 30 , " Add Thing" , function () add_entity (" thing" ) end )
923- make_button (ScreenWidth - 210 , 30 , " Add Line" , function () add_entity (" line" ) end )
924- make_button (ScreenWidth - 115 , 30 , " Add Sector" , function () add_entity (" sector" ) end )
925- make_button ( 10 , ScreenHeight - 40 , " +" , function () zoom ( 1 ) end )
926- make_button ( 10 , ScreenHeight - 10 , " -" , function () zoom (- 1 ) end )
927- make_button ( 40 , ScreenHeight - 24 , " <" , pan_left )
928- make_button ( 64 , ScreenHeight - 40 , " ^" , pan_up )
929- make_button ( 64 , ScreenHeight - 10 , " v" , pan_down )
930- make_button ( 88 , ScreenHeight - 24 , " >" , pan_right )
931- make_button (118 , ScreenHeight - 40 , " Reset View" , reset_view )
932- make_button (118 , ScreenHeight - 10 ,
925+ make_button (- 315 , 30 , " Add Thing" , function () add_entity (" thing" ) end )
926+ make_button (- 210 , 30 , " Add Line" , function () add_entity (" line" ) end )
927+ make_button (- 115 , 30 , " Add Sector" , function () add_entity (" sector" ) end )
928+ make_button ( 10 , - 40 , " +" , function () zoom ( 1 ) end )
929+ make_button ( 10 , - 10 , " -" , function () zoom (- 1 ) end )
930+ make_button ( 40 , - 24 , " <" , pan_left )
931+ make_button ( 64 , - 40 , " ^" , pan_up )
932+ make_button ( 64 , - 10 , " v" , pan_down )
933+ make_button ( 88 , - 24 , " >" , pan_right )
934+ make_button ( 118 , - 40 , " Reset View" , reset_view )
935+ make_button ( 118 , - 10 ,
933936 string.format (" Follow %s" , Follow and " ON " or " OFF" ), follow_toggle )
934937
935938 if CurrentPrompt then
0 commit comments