Desired properties:
Less important:
Current plan:
First example in this PR:
You could also release the mouse button and finish the stroke, then press 'ctrl-l' while hovering the mouse pointer on the stroke to turn it into a line.
There's an asymmetry here. Strokes require a lot more information, so while you can turn a stroke into a line, you can't turn a line into a stroke.
Strokes are an exception where you can't switch to freehand mode after you start drawing. You have to press C-f before drawing.
H7OEU6WPOKOSKV5RNAM5W62V5SYOY7VEA5VOK6JD5UEBUBIMOKUQC
KCIM5UTVV4KIL7SNRZFOW6FUQHGWAPOGQO4QTVNIWWBWMVG6GYNQC
HRWN5V6J6VMXS7WNSRGI7WMUSZ2OI52JJ4IK352VVSDZI4EF5HHQC
6LJZN727CRPYR34LV75CQF55YZI3E7MGESYZSFSYAE73SNEZE3FAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
D2GCFTTT2RNUBFB243YTA4F2H5ZXFTFHBSKHLZ2CX4JSKRZFTUUQC
3XD6M3CFKZJR365MHXUWJ4HGSDTPYO6WYZ4RGW7ECBBITKVQX24QC
elseif chord == 'C-f' then
current_mode = 'freehand'
elseif love.mouse.isDown('1') and chord == 'l' then
current_mode = 'line'
local drawing = current_drawing()
assert(drawing.pending.mode == 'freehand')
drawing.pending.mode = 'line'
drawing.pending.x1 = drawing.pending.points[1].x
drawing.pending.y1 = drawing.pending.points[1].y
end
end
end
function in_drawing()
local x, y = love.mouse.getX(), love.mouse.getY()
for _,drawing in ipairs(lines) do
if type(drawing) == 'table' then
if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then
return true
end
end
end
return false
end
function current_drawing()
local x, y = love.mouse.getX(), love.mouse.getY()
for _,drawing in ipairs(lines) do
if type(drawing) == 'table' then
if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then
return drawing
end