Now we should more reliably see at least 2 ticks along the top/bottom.
AU3CDALJIIHGTDB2ZAHTKJ4UWUPQ5M7RXO6J5ORIGKWHEXVRHLHAC
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":993,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":994,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":992,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":993,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
-- print(Viewport.zoom, Viewport.x, Viewport.x+iscale(App.screen.width))
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 4 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 8 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":991,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":990,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":992,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 4 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 8 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":990,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":990,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":991,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":989,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":990,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":987,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
print(Viewport.zoom, Viewport.x, Viewport.x+iscale(App.screen.width))
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"Save_viewport":865,"copy_viewport":866,"on.text_input":855,"schema1_of_y":667,"zoom_out":908,"on.initialize":948,"Zoomed_out":869,"A":831,"Surface":422,"get_multiple_definitions_from_app":783,"zoom_in":920,"fw_parent":988,"wait_for_response":781,"Viewport":604,"vy":956,"load_definition":854,"on.mouse_press":916,"load_manifest":694,"get_manifest":768,"box_height":680,"draw_run_time_error":808,"on.keychord_press":919,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"animate_next":914,"table_and_array_both_empty":689,"animate_next_frame":915,"survey_animation":950,"Definition_background_color":849,"fw_app":"driver","manifest_coord":636,"draw_cursor":639,"compute_layout":385,"surface_bounds":814,"Manifest":769,"Menu_command_color":613,"definition_background_color":859,"scale":712,"font":353,"undo_zoom_out":921,"Manifest_navigator":495,"Num_animation_frames":840,"Spawn_point":822,"line_height":365,"Failing_test_definition_background_color":925,"on.code_submit":947,"Menu_background_color":611,"get_definition_from_app":784,"Menu_border_color":612,"draw_load_time_error":929,"on_handle":547,"draw_test_failure_indicator":935,"Menu_highlight_color":614,"Page":475,"draw_menu_bar":861,"on_text":539,"add_hotkey_to_menu":616,"interpolate_viewport":843,"get_default_map":937,"draw_manifest_navigator":677,"on.update":945,"num_lines_for_manifest_navigator":676,"sx":955,"on.code_change":924,"vx":545,"reset_manifest_navigator":772,"B":830,"load_from_iterator":670,"on.mouse_release":836,"y_of_schema1":364,"on.key_release":720,"on.draw":986,"initialize_editor":678,"from_viewport":823,"manifest_navigator_up":628,"iscale":953,"manifest_navigator_down":635,"Animating":842,"sy":954,"delete_definition":673,"mouse_cursor":558,"move_candidate_to_front_of_manifest":632,"Mouse_cursor":559,"keychord_press_on_manifest_navigator":765,"on":1,"text_input_on_manifest_navigator":634,"set_mouse_cursor":562,"test_approximate_up":983,"draw_ticks":989,"approximate_up":985,"manifest_index":637,"add_thick_line":400,"manifest_navigator_candidates":638,"initialize_manifest_navigator":773,"Cursor_node":172,"add_def_to_menu":640,"tick_spec":987,"order_of_magnitude":573,"Test_definition_background_color":858,"new_definition":848,"maybe_update_key_in_definitions":529,"update_editor_box":711,"approximate":579,"copy_shape":396,"snapshot_canvas":913,"Ticks_font":669}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, Viewport.x+iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, Viewport.y+iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":988,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":987,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":987,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":986,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":986,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":987,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":986,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
on.draw = function()
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
draw_load_time_error(obj)
end
end
end
draw_run_time_error()
draw_test_failure_indicator()
draw_ticks()
draw_menu_bar()
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":985,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":986,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":984,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":985,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
-- step 1: scale down
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
if n == 0 then n = 1 end
-- step 2: scale back up
local magnitude = 1
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":983,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":984,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
-- step 1: scale down
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
if n == 0 then n = 1 end
-- step 2: scale back up
for i=1,zeros do
n = n*10
magnitude = magnitude*10
end
return n, magnitude
end
test_approximate_up = function()
check_eq(approximate_up(12, 1), 20, 'easy case')
-- when scale down ends up at 0
check_eq(approximate_up(2, 1), 10, 'below 5')
check_eq(approximate_up(7, 1), 10, 'above 5')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":982,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":983,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
check_eq(approximate_up(12, 1), 20, 'easy case')
check_eq(approximate_up(2, 1), 10, 'below 5')
check_eq(approximate_up(7, 1), 10, 'above 5')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":981,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":982,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- handle when scale-down ends up at 0
check_eq(approximate_up(2, 1), 10, 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(approximate_up(7, 1), 10, 'approximate_up/2')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":980,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":981,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(approximate_up(7, 1), 10, 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(approximate_up(17, 1), 20, 'approximate_up/2')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":979,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":980,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(approximate_up(2, 1), 10, 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(approximate_up(12, 1), 20, 'approximate_up/2')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":978,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":979,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(10, approximate_up(2, 1), 'approximate_up/1')
-- scale-down doesn't end at 0
check_eq(2000, approximate_up(12, 1), 'approximate_up/2')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":977,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":978,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
-- scale-down ends up at 0
check_eq(10, approximate_up(5, 1), 'approximate_up/1')
-- scale-down doesn't end at 0
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result, 'approximate_up/2')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":976,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":977,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":975,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":976,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
-- step 1: scale down
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
-- step 2: scale back up
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":974,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":975,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
for i=1,zeros do
n = n/10
end
n = math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":973,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":974,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
on.draw = function()
if Animating then
local q = love.graphics.newQuad((Viewport.x-Global_viewport.x)*Viewport.zoom,(Viewport.y-Global_viewport.y)*Viewport.zoom, App.screen.width, App.screen.height, Global_viewport.w*Viewport.zoom, Global_viewport.h*Viewport.zoom)
App.color{r=1,g=1,b=1}
love.graphics.draw(Canvas, q, 0,0)
return
end
for _,obj in ipairs(Surface) do
love.graphics.setColor(obj.r or 0, obj.g or 0, obj.b or 0)
if obj.type == 'rectangle' then
love.graphics.rectangle(obj.drawmode or 'fill', vx(obj.x),vy(obj.y), scale(obj.w),scale(obj.h))
elseif obj.type == 'line' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'circle' then
love.graphics.circle(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radius))
elseif obj.type == 'arc' then
love.graphics.arc(obj.drawmode or 'line', obj.arctype or 'open', vx(obj.x), vy(obj.y), scale(obj.radius), obj.angle1, obj.angle2, obj.segments)
elseif obj.type == 'ellipse' then
love.graphics.ellipse(obj.drawmode or 'fill', vx(obj.x), vy(obj.y), scale(obj.radiusx), scale(obj.radiusy))
elseif obj.type == 'bezier' then
love.graphics.line(unpack(obj.zdata))
elseif obj.type == 'text' then
if obj.w == nil then
love.graphics.draw(obj.text, vx(obj.x), vy(obj.y))
else
love.graphics.setColor(0.5,0.5,0.5)
love.graphics.rectangle('fill', vx(obj.x),vy(obj.y-30), scale(obj.w/2-5), scale(20))
edit.draw(obj.editor, obj.fg, not obj.show_cursor)
draw_load_time_error(obj)
end
end
end
draw_run_time_error()
draw_test_failure_indicator()
--draw_ticks()
draw_menu_bar()
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":972,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":973,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":972,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":971,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":972,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":970,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":971,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
approximate_up = function(n, zeros)
-- turn n into a number with n zeros
local magnitude = 1
for i=1,zeros do
magnitude = magnitude*10
end
n = n + magnitude/2
print('a', n)
for i=1,zeros do
n = n/10
end
n= math.ceil(n)
for i=1,zeros do
n = n*10
end
return n, magnitude
end
test_approximate_up = function()
check_eq(10, approximate_up(5, 1), 'approximate_up/1')
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result, 'approximate_up/2')
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":969,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":970,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
check_eq(10, approximate_up(5, 1), 'foo')
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":968,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":969,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
check_eq(10, approximate_up(5, 1), 'foo')
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":967,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":968,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
check_eq(10, approximate_up(5, 1))
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":965,"wait_for_response":781,"load_definition":854,"get_default_map":937,"iscale":953,"animate_next_frame":915,"Zoomed_out":869,"on.code_change":924,"copy_shape":396,"y_of_schema1":364,"on.save_settings":742,"Menu_highlight_color":614,"on.load_settings":940,"mouse_cursor":558,"Definitions":503,"draw_run_time_error":808,"draw_menu_bar":861,"on_text":539,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"delete_definition":673,"animate_next":914,"box_height":680,"sx":955,"compute_layout":385,"vy":956,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"tick_spec":962,"zoom_out":908,"test_approximate_up":967,"initialize_editor":678,"Surface":422,"approximate":579,"on":1,"on.draw":932,"vx":545,"surface_bounds":814,"Viewport":604,"initialize_manifest_navigator":773,"add_thick_line":400,"Mouse_cursor":559,"approximate_up":658,"survey_animation":950,"order_of_magnitude":573,"sy":954,"Spawn_point":822,"Animating":842,"from_viewport":823,"on.keychord_press":919,"on.key_release":720,"Page":475,"on.mouse_release":836,"draw_manifest_navigator":677,"interpolate_viewport":843,"num_lines_for_manifest_navigator":676,"on.text_input":855,"B":830,"reset_manifest_navigator":772,"scale":712,"set_mouse_cursor":562,"load_from_iterator":670,"on.update":945,"get_definition_from_app":784,"on.mouse_press":916,"Manifest_navigator":495,"on.code_submit":947,"line_height":365,"zoom_in":920,"Num_animation_frames":840,"undo_zoom_out":921,"Menu_background_color":611,"font":353,"Menu_border_color":612,"definition_background_color":859,"Menu_command_color":613,"Manifest":769,"keychord_press_on_manifest_navigator":765,"fw_app":"driver","Definition_background_color":849,"add_hotkey_to_menu":616,"load_manifest":694}
test_approximate_up = function()
check_eq(10, approximate_up(5, 1)
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":965,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":966,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":965,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":964,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":964,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, iscale(App.screen.width))
-- print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, iscale(App.screen.height))
-- print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
test_approximate_up = function()
local result = approximate_up(1700, 3)
print(result)
check_eq(2000, result)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":963,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":964,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
test_approximate_up = function()
local result = approximate_up(1700, 3)
check_eq(2000, result)
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":962,"wait_for_response":781,"load_definition":854,"get_default_map":937,"schema1_of_y":667,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"test_approximate_up":963,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
-- print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":961,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":962,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
print(lo, hi, hi-lo)
print(order_of_magnitude(hi-lo))
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
print('lo', anchorlo, scale)
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":960,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":961,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":959,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":960,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
-- print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
-- print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
-- print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
-- print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
-- print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"Test_definition_background_color":858,"draw_cursor":639,"get_manifest":768,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"manifest_navigator_down":635,"on.initialize":948,"A":831,"move_candidate_to_front_of_manifest":632,"snapshot_canvas":913,"Save_viewport":865,"copy_viewport":866,"font":353,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"add_def_to_menu":640,"Failing_test_definition_background_color":925,"get_multiple_definitions_from_app":783,"draw_ticks":957,"Ticks_font":669,"draw_load_time_error":929,"draw_test_failure_indicator":935,"new_definition":848,"fw_parent":958,"wait_for_response":781,"load_definition":854,"get_default_map":937,"on.text_input":855,"manifest_coord":636,"on.code_change":924,"on.code_submit":947,"y_of_schema1":364,"on.save_settings":742,"draw_menu_bar":861,"on.load_settings":940,"mouse_cursor":558,"Zoomed_out":869,"draw_run_time_error":808,"zoom_out":908,"definition_background_color":859,"table_and_array_both_empty":689,"update_editor_box":711,"Cursor_node":172,"on.mouse_release":836,"animate_next":914,"fw_app":"driver","sx":955,"reset_manifest_navigator":772,"vy":956,"keychord_press_on_manifest_navigator":765,"animate_next_frame":915,"tick_spec":959,"num_lines_for_manifest_navigator":676,"schema1_of_y":667,"initialize_editor":678,"Surface":422,"approximate":579,"draw_manifest_navigator":677,"load_manifest":694,"vx":545,"surface_bounds":814,"Viewport":604,"compute_layout":385,"add_thick_line":400,"undo_zoom_out":921,"approximate_up":658,"Manifest":769,"zoom_in":920,"line_height":365,"Spawn_point":822,"Animating":842,"from_viewport":823,"Menu_border_color":612,"on.key_release":720,"Page":475,"Manifest_navigator":495,"on.mouse_press":916,"order_of_magnitude":573,"on.update":945,"on.keychord_press":919,"set_mouse_cursor":562,"B":830,"scale":712,"interpolate_viewport":843,"load_from_iterator":670,"sy":954,"get_definition_from_app":784,"survey_animation":950,"Mouse_cursor":559,"initialize_manifest_navigator":773,"on.draw":932,"on":1,"Num_animation_frames":840,"text_input_on_manifest_navigator":634,"Menu_background_color":611,"box_height":680,"delete_definition":673,"on_text":539,"Menu_command_color":613,"Definitions":503,"Menu_highlight_color":614,"copy_shape":396,"Definition_background_color":849,"add_hotkey_to_menu":616,"iscale":953}
tick_spec = function(lo, hi)
-- given an interval of numbers, return a nice set of ticks to draw for the interval
-- the ticks will try to be at multiples of 10, or some multiple of a power of 10
-- we don't want to overwhelm the viewer, so we'll aim for between 2 and 4 ticks
-- the ticks will be specified as a low and high value, and a delta between consecutive ticks
local anchorlo, scale = approximate(lo, order_of_magnitude(hi-lo))
local anchorhi = approximate_up(hi, order_of_magnitude(hi-lo))
print('---', lo, hi, order_of_magnitude(hi-lo), anchorlo, anchorhi, scale)
while (anchorhi-anchorlo)/scale < 2 do
print('a', anchorlo, anchorhi, scale, (anchorhi-anchorlo)/scale)
scale = scale/2
end
while (anchorhi-anchorlo)/scale > 4 do
print('b', scale, (anchorhi-anchorlo)/scale)
scale = scale*2
end
print('c', scale, (anchorhi-anchorlo)/scale)
while vy(anchorlo-scale) > Menu_bar_height+20 do
anchorlo = anchorlo-scale
end
while vy(anchorhi+scale) < App.screen.height-20 do
anchorhi = anchorhi+scale
end
print('d', scale, (anchorhi-anchorlo)/scale)
return anchorlo, anchorhi, scale
end
{"zoom_in":920,"initialize_manifest_navigator":773,"delete_definition":673,"move_candidate_to_front_of_manifest":632,"get_multiple_definitions_from_app":783,"text_input_on_manifest_navigator":634,"on_handle":547,"on.draw":932,"manifest_index":637,"manifest_navigator_candidates":638,"Manifest_navigator":495,"update_editor_box":711,"vy":956,"on.mouse_press":916,"y_of_schema1":364,"draw_run_time_error":808,"on.key_release":720,"on.keychord_press":919,"survey_animation":950,"animate_next":914,"mouse_cursor":558,"Mouse_cursor":559,"animate_next_frame":915,"set_mouse_cursor":562,"draw_ticks":957,"tick_spec":958,"undo_zoom_out":921,"Save_viewport":865,"surface_bounds":814,"Page":475,"Cursor_node":172,"Failing_test_definition_background_color":925,"order_of_magnitude":573,"copy_viewport":866,"load_definition":854,"add_thick_line":400,"draw_load_time_error":929,"Spawn_point":822,"draw_test_failure_indicator":935,"initialize_editor":678,"Test_definition_background_color":858,"box_height":680,"wait_for_response":781,"on":1,"on_text":539,"get_default_map":937,"on.save_settings":742,"Definition_background_color":849,"on.load_settings":940,"Animating":842,"snapshot_canvas":913,"Ticks_font":669,"Viewport":604,"from_viewport":823,"table_and_array_both_empty":689,"vx":545,"Num_animation_frames":840,"font":353,"copy_shape":396,"get_manifest":768,"get_definition_from_app":784,"load_manifest":694,"iscale":953,"approximate_up":658,"on.code_change":924,"sy":954,"definition_background_color":859,"B":830,"interpolate_viewport":843,"on.text_input":855,"approximate":579,"Definitions":503,"Surface":422,"Manifest":769,"manifest_navigator_down":635,"on.initialize":948,"Menu_background_color":611,"A":831,"Menu_border_color":612,"line_height":365,"Menu_command_color":613,"on.update":945,"Menu_highlight_color":614,"compute_layout":385,"draw_cursor":639,"sx":955,"add_hotkey_to_menu":616,"new_definition":848,"add_def_to_menu":640,"draw_manifest_navigator":677,"schema1_of_y":667,"num_lines_for_manifest_navigator":676,"keychord_press_on_manifest_navigator":765,"fw_parent":957,"reset_manifest_navigator":772,"fw_app":"driver","on.mouse_release":836,"load_from_iterator":670,"zoom_out":908,"maybe_update_key_in_definitions":529,"Zoomed_out":869,"draw_menu_bar":861,"on.code_submit":947,"manifest_coord":636,"manifest_navigator_up":628,"scale":712}
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":956,"y_of_schema1":364,"survey_animation":950,"sx":955,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":957,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":956,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, iscale(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, iscale(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, iscale(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, iscale(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
vy = function(sy)
-- turn surface coordinates into viewport coordinates
return Menu_bar_height + scale(sy-Viewport.y)
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":955,"y_of_schema1":364,"survey_animation":950,"sx":955,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":956,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
sx = function(vx)
-- turn viewport coordinates into surface coordinates
return iscale(vx) + Viewport.x
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":954,"y_of_schema1":364,"survey_animation":950,"sx":955,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
sy = function(vy)
-- turn viewport coordinates into surface coordinates
-- vy = Menu_bar_height + scale(sy-Viewport.y)
return iscale(vy-Menu_bar_height) + Viewport.y
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":953,"y_of_schema1":364,"survey_animation":950,"sx":544,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":954,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
iscale = function(vd)
return vd/Viewport.zoom
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":951,"y_of_schema1":364,"survey_animation":950,"sx":544,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":953,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":469,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
iscale = function(vd)
vd/Viewport.zoom
end
{"draw_menu_bar":861,"line_height":365,"Menu_background_color":611,"Menu_border_color":612,"Menu_command_color":613,"Menu_highlight_color":614,"zoom_out":908,"Definitions":503,"add_hotkey_to_menu":616,"draw_manifest_navigator":677,"on.code_submit":947,"num_lines_for_manifest_navigator":676,"zoom_in":920,"new_definition":848,"box_height":680,"initialize_manifest_navigator":773,"compute_layout":385,"manifest_navigator_up":628,"table_and_array_both_empty":689,"manifest_navigator_down":635,"get_multiple_definitions_from_app":783,"reset_manifest_navigator":772,"move_candidate_to_front_of_manifest":632,"load_from_iterator":670,"get_definition_from_app":784,"scale":712,"update_editor_box":711,"manifest_coord":636,"manifest_index":637,"manifest_navigator_candidates":638,"on_handle":547,"on.draw":932,"add_def_to_menu":640,"schema1_of_y":667,"draw_run_time_error":808,"keychord_press_on_manifest_navigator":765,"fw_parent":951,"y_of_schema1":364,"survey_animation":950,"sx":544,"animate_next":914,"on.mouse_press":916,"on.mouse_release":836,"on.update":945,"animate_next_frame":915,"on.keychord_press":919,"draw_cursor":639,"undo_zoom_out":921,"iscale":952,"on.save_settings":742,"Failing_test_definition_background_color":925,"on.key_release":720,"Mouse_cursor":559,"surface_bounds":814,"snapshot_canvas":913,"draw_load_time_error":929,"set_mouse_cursor":562,"draw_test_failure_indicator":935,"get_manifest":768,"maybe_update_key_in_definitions":529,"Manifest":769,"on.initialize":948,"Spawn_point":822,"on.load_settings":940,"get_default_map":937,"add_thick_line":400,"order_of_magnitude":573,"copy_shape":396,"draw_ticks":951,"initialize_editor":678,"fw_app":"driver","approximate":579,"on.text_input":855,"interpolate_viewport":843,"B":830,"definition_background_color":859,"A":831,"Cursor_node":172,"text_input_on_manifest_navigator":634,"on.code_change":924,"approximate_up":658,"Zoomed_out":869,"sy":469,"Surface":422,"font":353,"Ticks_font":669,"Num_animation_frames":840,"vx":545,"from_viewport":823,"Viewport":604,"mouse_cursor":558,"load_manifest":694,"vy":546,"Animating":842,"Manifest_navigator":495,"delete_definition":673,"Definition_background_color":849,"on_text":539,"load_definition":854,"on":1,"wait_for_response":781,"Test_definition_background_color":858,"copy_viewport":866,"Page":475,"Save_viewport":865,"tick_spec":660}
{"Save_viewport":865,"y_of_schema1":364,"copy_viewport":866,"get_manifest":768,"zoom_out":908,"load_manifest":694,"Zoomed_out":869,"on.code_change":924,"scale":712,"undo_zoom_out":921,"zoom_in":920,"Failing_test_definition_background_color":925,"draw_load_time_error":929,"Menu_border_color":612,"Manifest":769,"Menu_command_color":613,"Menu_highlight_color":614,"draw_menu_bar":861,"get_default_map":937,"Animating":842,"B":830,"draw_manifest_navigator":677,"num_lines_for_manifest_navigator":676,"reset_manifest_navigator":772,"load_from_iterator":670,"get_definition_from_app":784,"on.draw":932,"Surface":422,"manifest_navigator_up":628,"on.code_submit":947,"manifest_navigator_down":635,"add_hotkey_to_menu":616,"delete_definition":673,"schema1_of_y":667,"move_candidate_to_front_of_manifest":632,"on.text_input":855,"keychord_press_on_manifest_navigator":765,"on.mouse_press":916,"text_input_on_manifest_navigator":634,"on.mouse_release":836,"Spawn_point":822,"draw_cursor":639,"get_multiple_definitions_from_app":783,"manifest_index":637,"Menu_background_color":611,"on":1,"wait_for_response":781,"box_height":680,"add_def_to_menu":640,"on_handle":547,"sx":544,"sy":469,"draw_ticks":951,"Page":475,"initialize_manifest_navigator":773,"line_height":365,"on_text":539,"on.key_release":720,"approximate_up":658,"Definition_background_color":849,"draw_test_failure_indicator":935,"new_definition":848,"draw_run_time_error":808,"Manifest_navigator":495,"add_thick_line":400,"compute_layout":385,"mouse_cursor":558,"survey_animation":950,"Mouse_cursor":559,"animate_next":914,"manifest_coord":636,"tick_spec":660,"set_mouse_cursor":562,"from_viewport":823,"Num_animation_frames":840,"animate_next_frame":915,"update_editor_box":711,"Cursor_node":172,"on.keychord_press":919,"on.update":945,"fw_parent":950,"table_and_array_both_empty":689,"fw_app":"driver","order_of_magnitude":573,"load_definition":854,"font":353,"vy":546,"surface_bounds":814,"approximate":579,"Test_definition_background_color":858,"Viewport":604,"definition_background_color":859,"interpolate_viewport":843,"vx":545,"initialize_editor":678,"on.save_settings":742,"Definitions":503,"on.load_settings":940,"on.initialize":948,"A":831,"maybe_update_key_in_definitions":529,"manifest_navigator_candidates":638,"Ticks_font":669,"snapshot_canvas":913,"copy_shape":396}
draw_ticks = function()
if App.fake_key_press then return end -- disable in tests
local old_font = love.graphics.getFont()
love.graphics.setFont(Ticks_font)
love.graphics.setColor(0.6,0.6,0.6)
-- x axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.x, sx(App.screen.width))
print('x ticks', Viewport.x, App.screen.width, sx(App.screen.width), anchorlo, anchorhi, scale)
for x=anchorlo,anchorhi,scale do
local vx = vx(x)
love.graphics.line(vx, Menu_bar_height, vx, Menu_bar_height+5)
love.graphics.print(('%2.0f'):format(x), vx+2, Menu_bar_height+5)
love.graphics.line(vx, App.screen.height, vx, App.screen.height-5)
love.graphics.print(('%2.0f'):format(x), vx+2, App.screen.height-15)
end
-- y axis
local anchorlo, anchorhi, scale = tick_spec(Viewport.y, sy(App.screen.height))
print('y ticks', Viewport.y, App.screen.height, sx(App.screen.height), anchorlo, anchorhi, scale)
for y=anchorlo,anchorhi,scale do
local vy = vy(y)
love.graphics.line(0, vy, 5, vy)
love.graphics.print(('%2.0f'):format(y), 5, vy+2)
love.graphics.line(App.screen.width, vy, App.screen.width-5, vy)
love.graphics.print(('%2.0f'):format(y), App.screen.width-20, vy+2)
end
love.graphics.setFont(old_font)
end
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
print('bounds', minx,miny, maxx, maxy)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+100
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"survey_animation":950,"approximate_up":658,"animate_next":914,"sy":469,"animate_next_frame":915,"draw_cursor":639,"Failing_test_definition_background_color":925,"undo_zoom_out":921,"draw_load_time_error":929,"font":353,"surface_bounds":814,"on.save_settings":742,"on.load_settings":940,"initialize_editor":678,"get_default_map":937,"table_and_array_both_empty":689,"Ticks_font":669,"Menu_background_color":611,"interpolate_viewport":843,"get_manifest":768,"text_input_on_manifest_navigator":634,"Menu_command_color":613,"Menu_highlight_color":614,"on.text_input":855,"manifest_index":637,"Definitions":503,"manifest_navigator_candidates":638,"Surface":422,"add_def_to_menu":640,"vx":545,"Manifest":769,"Viewport":604,"Num_animation_frames":840,"load_manifest":694,"vy":546,"manifest_navigator_up":628,"on":1,"manifest_navigator_down":635,"maybe_update_key_in_definitions":529,"move_candidate_to_front_of_manifest":632,"on.initialize":948,"new_definition":848,"A":831,"copy_shape":396,"Test_definition_background_color":858,"B":830,"definition_background_color":859,"num_lines_for_manifest_navigator":676,"load_definition":854,"reset_manifest_navigator":772,"on_handle":547,"Animating":842,"load_from_iterator":670,"draw_menu_bar":861,"get_definition_from_app":784,"on_text":539,"delete_definition":673,"snapshot_canvas":913,"sx":544,"Save_viewport":865,"copy_viewport":866,"on.mouse_press":916,"on.code_change":924,"on.mouse_release":836,"zoom_out":908,"on.update":945,"Zoomed_out":869,"on.keychord_press":919,"keychord_press_on_manifest_navigator":765,"Menu_border_color":612,"draw_run_time_error":808,"Cursor_node":172,"zoom_in":920,"draw_test_failure_indicator":935,"from_viewport":823,"draw_manifest_navigator":677,"mouse_cursor":558,"manifest_coord":636,"Mouse_cursor":559,"tick_spec":660,"schema1_of_y":667,"y_of_schema1":364,"set_mouse_cursor":562,"compute_layout":385,"scale":712,"add_thick_line":400,"on.code_submit":947,"update_editor_box":711,"Manifest_navigator":495,"on.key_release":720,"Definition_background_color":849,"on.draw":932,"order_of_magnitude":573,"Page":475,"initialize_manifest_navigator":773,"line_height":365,"draw_ticks":862,"approximate":579,"box_height":680,"add_hotkey_to_menu":616,"get_multiple_definitions_from_app":783,"fw_parent":949,"Spawn_point":822,"fw_app":"driver","wait_for_response":781}
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
-- ensure 1px of white background all around
-- just in case the viewport ever goes
-- outside canvas bounds while animating
minx,miny, maxx,maxy = minx-1,miny-1, maxx+1,maxx+100
local zoomx = App.screen.width/(maxx-minx)
local zoomy = App.screen.height/(maxy-miny)
local zoom, cw, ch
if zoomx < zoomy then
zoom = zoomx
cw = maxx-minx
ch = cw*App.screen.height/App.screen.width
else
zoom = zoomy
ch = maxy-miny
cw = ch*App.screen.width/App.screen.height
end
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
snapshot_canvas()
-- initialize animation
Animating = {
copy_viewport(Global_viewport),
copy_viewport(Viewport),
}
Viewport.x = -App.screen.width/2
Viewport.y = -App.screen.height/2
Viewport.w = App.screen.width
Viewport.h = App.screen.height
Viewport.zoom = 1.0 --]]
end
{"font":353,"Surface":422,"mouse_cursor":558,"Mouse_cursor":559,"surface_bounds":814,"y_of_schema1":364,"Viewport":604,"set_mouse_cursor":562,"on.initialize":948,"A":831,"Spawn_point":822,"from_viewport":823,"interpolate_viewport":843,"Page":475,"approximate":579,"B":830,"draw_ticks":862,"sy":469,"Num_animation_frames":840,"add_thick_line":400,"copy_shape":396,"fw_parent":948,"on.text_input":855,"add_def_to_menu":640,"get_manifest":768,"Manifest_navigator":495,"on.update":945,"compute_layout":385,"Definition_background_color":849,"undo_zoom_out":921,"Test_definition_background_color":858,"approximate_up":658,"definition_background_color":859,"draw_cursor":639,"vx":545,"reset_manifest_navigator":772,"Ticks_font":669,"order_of_magnitude":573,"on.key_release":720,"Menu_background_color":611,"load_definition":854,"Menu_border_color":612,"initialize_editor":678,"Menu_command_color":613,"snapshot_canvas":913,"Menu_highlight_color":614,"Save_viewport":865,"on":1,"add_hotkey_to_menu":616,"Definitions":503,"on.save_settings":742,"zoom_out":908,"on.load_settings":940,"Zoomed_out":869,"on.code_submit":947,"on.mouse_release":836,"tick_spec":660,"load_manifest":694,"table_and_array_both_empty":689,"on.keychord_press":919,"update_editor_box":711,"manifest_navigator_up":628,"initialize_manifest_navigator":773,"manifest_navigator_down":635,"scale":712,"fw_app":"driver","get_multiple_definitions_from_app":783,"move_candidate_to_front_of_manifest":632,"new_definition":848,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"wait_for_response":781,"manifest_coord":636,"draw_manifest_navigator":677,"manifest_index":637,"num_lines_for_manifest_navigator":676,"manifest_navigator_candidates":638,"draw_load_time_error":929,"Failing_test_definition_background_color":925,"on.draw":932,"zoom_in":920,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":784,"vy":546,"draw_test_failure_indicator":935,"Cursor_node":172,"on_text":539,"draw_run_time_error":808,"box_height":680,"get_default_map":937,"survey_animation":949,"on.mouse_press":916,"sx":544,"on.code_change":924,"animate_next":914,"copy_viewport":866,"keychord_press_on_manifest_navigator":765,"delete_definition":673,"maybe_update_key_in_definitions":529,"Animating":842,"animate_next_frame":915,"line_height":365,"Manifest":769}
on.initialize = function()
if table_and_array_both_empty(Definitions) then
new_definition()
A()
else
survey_animation() -- calls A internally
end
end
{"font":353,"Surface":422,"mouse_cursor":558,"Mouse_cursor":559,"surface_bounds":814,"y_of_schema1":364,"Viewport":604,"set_mouse_cursor":562,"on.initialize":948,"A":831,"Spawn_point":822,"from_viewport":823,"interpolate_viewport":843,"Page":475,"approximate":579,"B":830,"draw_ticks":862,"sy":469,"Num_animation_frames":840,"add_thick_line":400,"copy_shape":396,"fw_parent":947,"on.text_input":855,"add_def_to_menu":640,"get_manifest":768,"Manifest_navigator":495,"on.update":945,"compute_layout":385,"Definition_background_color":849,"undo_zoom_out":921,"Test_definition_background_color":858,"approximate_up":658,"definition_background_color":859,"draw_cursor":639,"vx":545,"reset_manifest_navigator":772,"Ticks_font":669,"order_of_magnitude":573,"on.key_release":720,"Menu_background_color":611,"load_definition":854,"Menu_border_color":612,"initialize_editor":678,"Menu_command_color":613,"snapshot_canvas":913,"Menu_highlight_color":614,"Save_viewport":865,"on":1,"add_hotkey_to_menu":616,"Definitions":503,"on.save_settings":742,"zoom_out":908,"on.load_settings":940,"Zoomed_out":869,"on.code_submit":947,"on.mouse_release":836,"tick_spec":660,"load_manifest":694,"table_and_array_both_empty":689,"on.keychord_press":919,"update_editor_box":711,"manifest_navigator_up":628,"initialize_manifest_navigator":773,"manifest_navigator_down":635,"scale":712,"fw_app":"driver","get_multiple_definitions_from_app":783,"move_candidate_to_front_of_manifest":632,"new_definition":848,"draw_menu_bar":861,"text_input_on_manifest_navigator":634,"schema1_of_y":667,"wait_for_response":781,"manifest_coord":636,"draw_manifest_navigator":677,"manifest_index":637,"num_lines_for_manifest_navigator":676,"manifest_navigator_candidates":638,"draw_load_time_error":929,"Failing_test_definition_background_color":925,"on.draw":932,"zoom_in":920,"load_from_iterator":670,"on_handle":547,"get_definition_from_app":784,"vy":546,"draw_test_failure_indicator":935,"Cursor_node":172,"on_text":539,"draw_run_time_error":808,"box_height":680,"get_default_map":937,"survey_animation":906,"on.mouse_press":916,"sx":544,"on.code_change":924,"animate_next":914,"copy_viewport":866,"keychord_press_on_manifest_navigator":765,"delete_definition":673,"maybe_update_key_in_definitions":529,"Animating":842,"animate_next_frame":915,"line_height":365,"Manifest":769}