I'm seeing an artifact sometimes, and just realized it's because of wrapmode clamp if the viewport ever goes out of bounds of the clamp. This is likely to happen for small viewports, particularly small apps with little code to lay out.
36EJO2HGILPVXIKIGN665EMEQ4JJO4S32QZXHI76R45TVUKKVZGAC
survey_animation = function()
---[[ '--' at start to disable animation, '---' to enable
local minx, miny, maxx, maxy = surface_bounds(Definitions)
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
local desired_viewport = Viewport
Global_viewport = {x=minx, y=miny, w=cw, h=ch, zoom=zoom}
-- Render the canvas at pixel perfect resolution.
local winw,winh = App.screen.width, App.screen.height
App.screen.width,App.screen.height = Global_viewport.w, Global_viewport.h
Viewport = {x=minx, y=miny, w=cw, h=ch, zoom=1.0}
A()
Canvas = love.graphics.newCanvas(cw,ch)
love.graphics.setCanvas(Canvas)
App.run_tests = true -- Hack; disable drawing the menu and ticks
on.draw()
App.run_tests = nil
love.graphics.setCanvas()
App.screen.width,App.screen.height = winw,winh
-- initialize animation
Animating = {
Global_viewport,
desired_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
{"manifest_navigator_candidates":638,"approximate_up":658,"add_def_to_menu":640,"schema1_of_y":667,"Ticks_font":669,"on.mouse_press":722,"Manifest_navigator":495,"on.mouse_release":836,"y_of_schema1":364,"box_height":680,"on.keychord_press":828,"Page":475,"initialize_manifest_navigator":773,"tick_spec":660,"load_manifest":694,"get_multiple_definitions_from_app":783,"get_manifest":768,"wait_for_response":781,"Definitions":503,"font":353,"new_definition":821,"load_definition":716,"add_thick_line":400,"copy_shape":396,"compute_layout":385,"draw_run_time_error":808,"on.save_settings":742,"on.code_change":820,"on.load_settings":782,"survey_animation":845,"on.text_input":834,"table_and_array_both_empty":689,"animate_next_frame":825,"initialize_editor":678,"surface_bounds":814,"on.key_release":720,"on":1,"on.initialize":807,"Surface":422,"A":831,"fw_parent":844,"scale":712,"fw_app":"driver","Spawn_point":822,"sx":544,"from_viewport":823,"Viewport":604,"vx":545,"load_from_iterator":670,"Menu_command_color":613,"on_text":539,"Menu_highlight_color":614,"get_definition_from_app":784,"draw_menu_bar":641,"Menu_border_color":612,"add_hotkey_to_menu":616,"on_handle":547,"on.code_submit":787,"draw_manifest_navigator":677,"update_editor_box":711,"num_lines_for_manifest_navigator":676,"Animating":842,"mouse_cursor":558,"reset_manifest_navigator":772,"Num_animation_frames":840,"Cursor_node":172,"vy":546,"approximate":579,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":844,"animate_next":841,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"Mouse_cursor":559,"manifest_navigator_down":635,"line_height":365,"Menu_background_color":611,"delete_definition":673,"order_of_magnitude":573,"move_candidate_to_front_of_manifest":632,"Manifest":769,"keychord_press_on_manifest_navigator":765,"manifest_coord":636,"text_input_on_manifest_navigator":634,"B":830,"interpolate_viewport":843,"on.draw":797,"sy":469,"manifest_index":637,"on.update":835}
{"manifest_navigator_candidates":638,"approximate_up":658,"add_def_to_menu":640,"schema1_of_y":667,"Ticks_font":669,"on.mouse_press":722,"Manifest_navigator":495,"on.mouse_release":836,"y_of_schema1":364,"box_height":680,"on.keychord_press":828,"Page":475,"initialize_manifest_navigator":773,"tick_spec":660,"load_manifest":694,"get_multiple_definitions_from_app":783,"get_manifest":768,"wait_for_response":781,"Definitions":503,"font":353,"new_definition":821,"load_definition":716,"add_thick_line":400,"copy_shape":396,"compute_layout":385,"draw_run_time_error":808,"on.save_settings":742,"on.code_change":820,"on.load_settings":782,"survey_animation":827,"on.text_input":834,"table_and_array_both_empty":689,"animate_next_frame":825,"initialize_editor":678,"surface_bounds":814,"on.key_release":720,"on":1,"on.initialize":807,"Surface":422,"A":831,"fw_parent":843,"scale":712,"fw_app":"driver","Spawn_point":822,"sx":544,"from_viewport":823,"Viewport":604,"vx":545,"load_from_iterator":670,"Menu_command_color":613,"on_text":539,"Menu_highlight_color":614,"get_definition_from_app":784,"draw_menu_bar":641,"Menu_border_color":612,"add_hotkey_to_menu":616,"on_handle":547,"on.code_submit":787,"draw_manifest_navigator":677,"update_editor_box":711,"num_lines_for_manifest_navigator":676,"Animating":842,"mouse_cursor":558,"reset_manifest_navigator":772,"Num_animation_frames":840,"Cursor_node":172,"vy":546,"approximate":579,"set_mouse_cursor":562,"draw_cursor":639,"draw_ticks":844,"animate_next":841,"maybe_update_key_in_definitions":529,"manifest_navigator_up":628,"Mouse_cursor":559,"manifest_navigator_down":635,"line_height":365,"Menu_background_color":611,"delete_definition":673,"order_of_magnitude":573,"move_candidate_to_front_of_manifest":632,"Manifest":769,"keychord_press_on_manifest_navigator":765,"manifest_coord":636,"text_input_on_manifest_navigator":634,"B":830,"interpolate_viewport":843,"on.draw":797,"sy":469,"manifest_index":637,"on.update":835}
draw_ticks = function()
if App.run_tests 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))
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))
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