diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-09-05 12:47:27 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-09-05 12:47:27 -0700 |
commit | e0f750913fa653c03a666203e04c59e847e73bff (patch) | |
tree | 037a1062d40b54331ee0cbe797b5bd8ede551180 /source_undo.lua | |
parent | fc98407c930f1ba48a48657031bae06991666449 (diff) | |
parent | fdb35ce12bd8b2e30522ada07ec756a626d01a09 (diff) | |
download | view.love-e0f750913fa653c03a666203e04c59e847e73bff.tar.gz |
Merge lines.love
Diffstat (limited to 'source_undo.lua')
-rw-r--r-- | source_undo.lua | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/source_undo.lua b/source_undo.lua index 0aa6755..6023324 100644 --- a/source_undo.lua +++ b/source_undo.lua @@ -50,6 +50,8 @@ function snapshot(State, s,e) screen_top=deepcopy(State.screen_top1), selection=deepcopy(State.selection1), cursor=deepcopy(State.cursor1), + current_drawing_mode=Drawing_mode, + previous_drawing_mode=State.previous_drawing_mode, lines={}, start_line=s, end_line=e, @@ -58,7 +60,19 @@ function snapshot(State, s,e) -- deep copy lines without cached stuff like text fragments for i=s,e do local line = State.lines[i] - table.insert(event.lines, {data=line.data, dataB=line.dataB}) + if line.mode == 'text' then + table.insert(event.lines, {mode='text', data=line.data, dataB=line.dataB}) + elseif line.mode == 'drawing' then + local points=deepcopy(line.points) +--? print('copying', line.points, 'with', #line.points, 'points into', points) + local shapes=deepcopy(line.shapes) +--? print('copying', line.shapes, 'with', #line.shapes, 'shapes into', shapes) + table.insert(event.lines, {mode='drawing', h=line.h, points=points, shapes=shapes, pending={}}) +--? table.insert(event.lines, {mode='drawing', h=line.h, points=deepcopy(line.points), shapes=deepcopy(line.shapes), pending={}}) + else + print(line.mode) + assert(false) + end end return event end |