bugfix: undo drawing creation
Also clean up drawing state to make sure we don't get into hard-to-debug situations.
This commit is contained in:
parent
670886240f
commit
b4e76eac4e
|
@ -348,7 +348,10 @@ function Drawing.mouse_released(x,y, button)
|
|||
end
|
||||
end
|
||||
save_to_disk(Lines, Filename)
|
||||
record_undo_event({before=Drawing.before, after=snapshot_everything()})
|
||||
if Drawing.before then
|
||||
record_undo_event({before=Drawing.before, after=snapshot_everything()})
|
||||
Drawing.before = nil
|
||||
end
|
||||
end
|
||||
|
||||
function Drawing.keychord_pressed(chord)
|
||||
|
|
1
main.lua
1
main.lua
|
@ -142,6 +142,7 @@ function App.draw()
|
|||
button('draw', {x=4,y=y+4, w=12,h=12, color={1,1,0},
|
||||
icon = icon.insert_drawing,
|
||||
onpress1 = function()
|
||||
Drawing.before = snapshot_everything()
|
||||
table.insert(Lines, line_index, {mode='drawing', y=y, h=256/2, points={}, shapes={}, pending={}})
|
||||
if Cursor1.line >= line_index then
|
||||
Cursor1.line = Cursor1.line+1
|
||||
|
|
Loading…
Reference in New Issue