Deleting a point deletes all shapes that use it (but not other points in those shapes).
FBDRL6LHPTBPMU3R356OLY4XE4ELQQEDXMCZGCBT2RFHLR7VQXQAC
VQFBNHU4GQYICYL6I7HTYHWAL4J2YQNPG6SDCNOEQL4CJ7OQAULQC
T664AOUGOSFMPZAO6OGKJ26R22ORJUIBVG3QZOJL24MQXYEHBXOQC
GCUARQ2GJT3Y5K6LOOA6S7SOBMSXU7VV7LT355TOMFFPBQ3ZVYKAC
SNDZOK6QJUASKYLYBHIATA7WXPCPZTEYEWA63I4H7HH3JT3B4U6AC
IFGAJAF7UWM236QV4NWP2C67TJPQGXNBC2RTZCOWPJUJYYC2MMXAC
OTIBCAUJ3KDQJLVDN3A536DLZGNRYMGJLORZVR3WLCGXGO6UGO6AC
ZOOY3ME4BUD6RLWCKZFA62JNN4BMPOXH24HGTFWPWEKDECOXMFUAC
JCSLDGAH2F6AIY4Z6XM6K4LOMW7EFY3E4NF5YXLMHLTYTX3A4Z3QC
D2GCFTTT2RNUBFB243YTA4F2H5ZXFTFHBSKHLZ2CX4JSKRZFTUUQC
WDWXNW7VH57W6KXBNXFV6NPIO5RUS7Q6QNGGI4R6HWIRXLYI5NSAC
3XD6M3CFKZJR365MHXUWJ4HGSDTPYO6WYZ4RGW7ECBBITKVQX24QC
WAZVXUV2LMNGGR6WQ3NIFGSKYYLHMQAOM6VPRU4O2A3IJVLSSEZAC
HWPK4SMPGZMXWXKCVX667676ZWN5Q2XZSTMVAADG7JNRF6XE45RQC
if near(p, mx,my) then
love.graphics.setColor(1,0,0)
love.graphics.circle('line', pixels(p.x)+16,pixels(p.y)+line.y, 4)
else
love.graphics.setColor(0,0,0)
love.graphics.circle('fill', pixels(p.x)+16,pixels(p.y)+line.y, 2)
if p.deleted == nil then
if near(p, mx,my) then
love.graphics.setColor(1,0,0)
love.graphics.circle('line', pixels(p.x)+16,pixels(p.y)+line.y, 4)
else
love.graphics.setColor(0,0,0)
love.graphics.circle('fill', pixels(p.x)+16,pixels(p.y)+line.y, 2)
end
end
elseif chord == 'C-d' and not love.mouse.isDown('1') then
local drawing,i,p = select_point_at_mouse()
if drawing then
for _,shape in ipairs(drawing.shapes) do
if contains_point(shape, i) then
shape.mode = 'deleted'
end
end
drawing.points[i].deleted = true
end
local drawing,i,shape = select_shape_at_mouse()
if drawing then
shape.mode = 'deleted'
function contains_point(shape, p)
if shape.mode == 'freehand' then
-- not supported
elseif shape.mode == 'line' then
print(p, shape.p1, shape.p2)
return shape.p1 == p or shape.p2 == p
elseif shape.mode == 'polygon' then
return table.find(shape.vertices, p)
elseif shape.mode == 'circle' then
return shape.center == p
elseif shape.mode == 'arc' then
return shape.center == p
-- ugh, how to support angles
elseif shape.mode == 'deleted' then
-- already done
else
assert(false)
end
end