X22MOJHFLXMZQJN4IP2HAXIIVD2ALPR4EO5V5YDYF6QPXS7ZNB6QC
J3ER7DFO2TXYUMJAXZUFEHQNLFDNIXSYDTE7HEFGQ2RYB3A6RFPAC
3ZTODUBQ727WK7NTCYBCEBBL4ASOQ6FB37GZM6W3SSTN5FEKGQHAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
BYG5CEMVXANDTBI2ORNVMEY6K3EBRIHZHS4QBK27VONJC5537COQC
2L5MEZV344TOZLVY3432RHJFIRVXFD6O3GWLL5O4CV66BGAFTURQC
4BX4GJEWW7Z5LA4SJUXADYLAHOYFL4IBOYH4J4DJYRAVKKGGFHGQC
MTJEVRJR5GLWUSK7HMIM4UXM6GS6O6YCRWJT3DUSU2RYMHCQNOEQC
LNUHQOGHIOFGJXNGA3DZLYEASLYYDGLN2I3EDZY5ANASQAHCG3YQC
LF7BWEG4DKQI7NMXMZC4LC2BE5PB42HK5PD6OYBNIDMAZBJASOKQC
PTDO2SOTXEI6FROZ2AVRFXSKKNKCRMPPTQSI5LWD45UVGDJPMSGQC
--? love.graphics.setColor(0,0,1)
--? love.graphics.line(pane.left, pane.top, pane.left + Display_settings.column_width, pane.top)
--? love.graphics.line(pane.left, pane.top + Cache[pane.id].height - Padding_vertical*2, pane.left + Display_settings.column_width, pane.top + Cache[pane.id].height - Padding_vertical*2)
--? function App.update(dt)
--? Cursor_time = Cursor_time + dt
--? -- some hysteresis while resizing
--? if Last_resize_time then
--? if App.getTime() - Last_resize_time < 0.1 then
--? return
--? else
--? Last_resize_time = nil
--? end
--? end
--? if App.mouse_x() >= Editor_state.left-Margin_left and App.mouse_x() < Editor_state.right+Margin_right then
--? love.mouse.setCursor(love.mouse.getSystemCursor('arrow'))
--? edit.update(Editor_state, dt)
--? else
--? love.mouse.setCursor(love.mouse.getSystemCursor('hand'))
--? end
--? if Pan.x then
--? Editor_state.left = Margin_left - math.max(Pan.x-App.mouse_x(), 0)
--? Editor_state.right = 400 + Margin_right - math.max(Pan.x-App.mouse_x(), 0)
--? Editor_state.width = Editor_state.right - Editor_state.left
--? Editor_state.top = Margin_top - math.max(Pan.y-App.mouse_y(), 0)
--? --? Display_settings.x = math.max(Pan.x-App.mouse_x(), 0)
--? --? Display_settings.y = math.max(Pan.y-App.mouse_y(), 0)
--? --? App.mouse_move(Pan.x-Display_settings.x, Pan.y-Display_settings.y)
--? end
--? end
--?
function App.update(dt)
Cursor_time = Cursor_time + dt
-- some hysteresis while resizing
if Last_resize_time then
if App.getTime() - Last_resize_time < 0.1 then
return
else
Last_resize_time = nil
end
end
if App.mouse_y() < Header_height then
-- column header
love.mouse.setCursor(love.mouse.getSystemCursor('arrow'))
elseif in_pane(App.mouse_x(), App.mouse_y()) then
love.mouse.setCursor(love.mouse.getSystemCursor('arrow'))
else
love.mouse.setCursor(love.mouse.getSystemCursor('hand'))
end
if Pan.x then
Display_settings.x = math.max(Pan.x-App.mouse_x(), 0)
Display_settings.y = math.max(Pan.y-App.mouse_y(), 0)
end
end
function in_pane(x,y)
local sx,sy = to_surface(x,y)
local x = Gutter_width + Padding_horizontal
for column_idx, column in ipairs(Surface) do
if sx < x then
return false
end
if sx < x + Margin_left + Display_settings.column_width + Margin_right then
local y = Margin_top
for pane_idx, pane in ipairs(column) do
if sy < y then
return false
end
if sy < y + Cache[pane.id].height - Padding_vertical*2 then
return true
end
y = y + Cache[pane.id].height
end
end
x = x + Margin_left + Display_settings.column_width + Margin_right + Padding_horizontal + Gutter_width + Padding_horizontal
end
return false
end
function to_surface(x, y)
return x+Display_settings.x, y+Display_settings.y
end
--? end
--?
--? function App.mousepressed(x,y, mouse_button)
--? Cursor_time = 0 -- ensure cursor is visible immediately after it moves
--? if x >= Editor_state.left - Margin_left and x < Editor_state.right + Margin_right then
--? return edit.mouse_pressed(Editor_state, x,y, mouse_button)
--? else
--? Pan = {x=x, y=y}
--? end
--? end
--?
--? function App.mousereleased(x,y, mouse_button)
--? Cursor_time = 0 -- ensure cursor is visible immediately after it moves
--? if x >= Editor_state.left - Margin_left and x < Editor_state.right + Margin_right then
--? return edit.mouse_released(Editor_state, x,y, mouse_button)
--? else
--? Pan = {}
--? end
--?
function App.mousepressed(x,y, mouse_button)
Cursor_time = 0 -- ensure cursor is visible immediately after it moves
Selection_first = {}
Selection_second = {}
Pan = {}
if y < Margin_top then
-- column headers currently not interactable
return
end
local sx,sy = to_surface(x,y)
if not in_pane(x,y) then
Pan = {x=sx, y=sy}
return
end
end
function App.mousereleased(x,y, mouse_button)
Cursor_time = 0 -- ensure cursor is visible immediately after it moves
Pan = {}
end
-- insert new drawing
button('draw', {x=State.left - Margin_left + 4,y=y+4, w=12,h=12, color={1,1,0},
--? icon = icon.insert_drawing,
onpress1 = function()
Drawing.before = snapshot(State, line_index-1, line_index)
table.insert(State.lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})
if State.cursor1.line >= line_index then
State.cursor1.line = State.cursor1.line+1
end
schedule_save(State)
record_undo_event(State, {before=Drawing.before, after=snapshot(State, line_index-1, line_index+1)})
end,
})
if State.show_cursor then
button('draw', {x=State.left - Margin_left + 4,y=y+4, w=12,h=12, color={1,1,0},
--? icon = icon.insert_drawing, -- TODO
onpress1 = function()
Drawing.before = snapshot(State, line_index-1, line_index)
table.insert(State.lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})
if State.cursor1.line >= line_index then
State.cursor1.line = State.cursor1.line+1
end
schedule_save(State)
record_undo_event(State, {before=Drawing.before, after=snapshot(State, line_index-1, line_index+1)})
end,
})
end