DRY some code
[?]
May 18, 2022, 6:10 AM
3RGHOJ25MCTQ5CRQADFIVJ53QZWRSIQOFGXLFGKQ765QABJ5S54ACDependencies
- [2]
VHQCNMARseveral more modules - [3]
XNFTJHC4split keyboard handling between Text and Drawing - [4]
JCSLDGAHbeginnings of support for multiple shapes - [5]
ZD63LJ2Tbugfix: keep the click to create a new drawing from creating a new shape in the drawing - [6]
OTIBCAUJlove2d scaffold - [7]
POT3XFCTrename - [8]
EFMLTMZGbugfix: restrict strokes to the drawing they started in - [9]
KCIM5UTVrevert: back to freehand - [10]
L5USRTY2inline - [11]
WDWXNW7Vslightly strange way to move points - [12]
MNWHXPBLmore lightweight; select just the stroke at the mouse - [13]
SNDZOK6Qslightly less strange now that we have the same two ways to move points as any other operation - [14]
VVXVV2D2change data model; text can now have metadata - [15]
O2UFJ6G3switch from freehand to just straight lines - [16]
XX7G2FFJintermingle freehand line drawings with text - [17]
TRCAEE2Aclip drawings inside the border - [18]
JVRL5TWLstore device-independent coordinates inside drawings - [19]
MGOQ5XAVstart uppercasing globals - [20]
AVQ5MC5Dfinish uppercasing all globals - [*]
BLWAYPKVextract a module
Change contents
- edit in main.lua at line 129
if Lines.current == nil then return endlocal drawing = Lines.currentassert(drawing.mode == 'drawing')local x, y = love.mouse.getX(), love.mouse.getY() - replacement in main.lua at line 134[3.109]→[3.357:467](∅→∅),[3.32]→[3.2:60](∅→∅),[3.104]→[3.2:60](∅→∅),[3.467]→[3.2:60](∅→∅),[3.780]→[3.2:60](∅→∅),[3.1463]→[3.2:60](∅→∅),[3.60]→[2.174:288](∅→∅),[2.288]→[3.1397:1450](∅→∅),[3.350]→[3.1397:1450](∅→∅),[3.1736]→[3.1397:1450](∅→∅),[3.957]→[3.1397:1450](∅→∅),[3.1450]→[2.289:425](∅→∅),[2.425]→[3.3:56](∅→∅),[3.471]→[3.3:56](∅→∅),[3.56]→[2.426:500](∅→∅),[2.500]→[3.114:210](∅→∅),[3.114]→[3.114:210](∅→∅),[3.210]→[3.1570:1584](∅→∅),[3.471]→[3.1570:1584](∅→∅),[3.1570]→[3.1570:1584](∅→∅),[3.87]→[3.1647:1659](∅→∅),[3.229]→[3.1647:1659](∅→∅),[3.634]→[3.1647:1659](∅→∅),[3.1068]→[3.1647:1659](∅→∅),[3.1584]→[3.1647:1659](∅→∅),[3.1647]→[3.1647:1659](∅→∅)
if Lines.current thenif Lines.current.mode == 'drawing' thenlocal drawing = Lines.currentlocal x, y = love.mouse.getX(), love.mouse.getY()if y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width thenif drawing.pending.mode == 'freehand' thentable.insert(drawing.pending.points, {x=Drawing.coord(love.mouse.getX()-16), y=Drawing.coord(love.mouse.getY()-drawing.y)})elseif drawing.pending.mode == 'move' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y)drawing.pending.target_point.x = mxdrawing.pending.target_point.y = myendendif Drawing.in_drawing(drawing, x,y) thenif drawing.pending.mode == 'freehand' thentable.insert(drawing.pending.points, {x=Drawing.coord(love.mouse.getX()-16), y=Drawing.coord(love.mouse.getY()-drawing.y)})elseif drawing.pending.mode == 'move' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y)drawing.pending.target_point.x = mxdrawing.pending.target_point.y = my - replacement in main.lua at line 144[2.546]→[3.468:502](∅→∅),[3.1774]→[3.468:502](∅→∅),[3.61]→[3.468:502](∅→∅),[3.502]→[3.95:149](∅→∅),[3.95]→[3.95:149](∅→∅),[3.149]→[2.547:657](∅→∅)
local drawing = Lines.currentlocal x, y = love.mouse.getX(), love.mouse.getY()if y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width thenif Drawing.in_drawing(drawing, x, y) then - replacement in drawing.lua at line 289
if y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width thenif Drawing.in_drawing(drawing, x,y) then - replacement in drawing.lua at line 301
if y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width thenlocal mx,my = Drawing.coord(love.mouse.getX()-16), Drawing.coord(love.mouse.getY()-drawing.y)if Drawing.in_drawing(drawing, x,y) thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y) - replacement in drawing.lua at line 318
if y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width thenlocal mx,my = Drawing.coord(love.mouse.getX()-16), Drawing.coord(love.mouse.getY()-drawing.y)if Drawing.in_drawing(drawing, x,y) thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y) - replacement in drawing.lua at line 335
if y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width thenif Drawing.in_drawing(drawing, x,y) then