store device-independent coordinates inside drawings
[?]
May 12, 2022, 3:29 PM
JVRL5TWLBTWMTHJDZSDN5XQDMEIIPVAZBKUP75HMO7JHURAYWG5QCDependencies
- [2]
L5USRTY2inline - [3]
MNWHXPBLmore lightweight; select just the stroke at the mouse - [4]
3XD6M3CFrefactor - [5]
2C7CTIQYmake space for multiple kinds of width - [6]
YHQC72JXslightly tweak boundary between concerns - [7]
EFMLTMZGbugfix: restrict strokes to the drawing they started in - [8]
POT3XFCTrename - [9]
G77XIN7Mselecting a stroke - [10]
WAZVXUV2simplest possible way to straighten strokes - [11]
R3WSFYGYspacing - [12]
OTIBCAUJlove2d scaffold - [13]
T76KKDWZturn strokes into horizontal and vertical lines - [14]
Z2CJVAPVlighter border for figures - [15]
XX7G2FFJintermingle freehand line drawings with text - [16]
TRCAEE2Aclip drawings inside the border - [*]
IZZVOCLBconfirm that we have access to all of the love API
Change contents
- edit in main.lua at line 8[5.45][18.2]
-- All drawings span 100% of some conceptual 'page width' and divide it up-- into 256 parts. `drawingw` describes their width in pixels.drawingw = 400 -- pixelsfunction pixels(n) -- parts to pixelsreturn n*drawingw/256endfunction coord(n) -- pixels to partsreturn math.floor(n*256/drawingw)end - replacement in main.lua at line 48
table.insert(lines, i, {y=y, w=400, h=200, pending={}, shapes={}})table.insert(lines, i, {y=y, h=256/2, pending={}, shapes={}}) - replacement in main.lua at line 54
y = y+line.hlove.graphics.rectangle('line', 12,line.y, line.w,line.h)y = y+pixels(line.h)love.graphics.rectangle('line', 12,line.y, drawingw,pixels(line.h))local mx,my = coord(love.mouse.getX()-12), coord(love.mouse.getY()-line.y) - replacement in main.lua at line 60
if on_freehand(love.mouse.getX(),love.mouse.getY(), shape) thenif on_freehand(mx,my, shape) then - replacement in main.lua at line 68
love.graphics.line(prev.x,prev.y, point.x,point.y)love.graphics.line(pixels(prev.x)+12,pixels(prev.y)+line.y, pixels(point.x)+12,pixels(point.y)+line.y) - replacement in main.lua at line 76
love.graphics.line(prev.x,prev.y, point.x,point.y)love.graphics.line(pixels(prev.x)+12,pixels(prev.y)+line.y, pixels(point.x)+12,pixels(point.y)+line.y) - replacement in main.lua at line 99
if y >= drawing.y and y < drawing.y + drawing.h and x >= 12 and x < 12+drawing.w thentable.insert(drawing.pending, {x=love.mouse.getX(), y=love.mouse.getY()})if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw thentable.insert(drawing.pending, {x=coord(love.mouse.getX()-12), y=coord(love.mouse.getY()-drawing.y)}) - replacement in main.lua at line 116
if y >= drawing.y and y < drawing.y + drawing.h and x >= 12 and x < 12+drawing.w thenif y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then - replacement in main.lua at line 207
if y >= drawing.y and y < drawing.y + drawing.h and x >= 12 and x < 12+drawing.w thenif y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw thenlocal mx,my = coord(love.mouse.getX()-12), coord(love.mouse.getY()-drawing.y) - replacement in main.lua at line 210
if on_freehand(love.mouse.getX(),love.mouse.getY(), shape) thenif on_freehand(mx,my, shape) then