more precise shape selection
[?]
Jun 18, 2022, 6:15 AM
WPW3AVFS3WQVHNSCYVKX7ABWTQUUGVO4SXYCJZT2WOL6TOITX7EQCDependencies
- [2]
B4YZWV6Sbugfix: checking if a point is on a manhattan line - [3]
LAW2O3NWextract variable Margin_left - [4]
K2X6G75Zstart writing some tests for drawings - [5]
VHQCNMARseveral more modules - [6]
LYN3L74Wcorrect commit f3abc2cbf2 - [7]
XNFTJHC4split keyboard handling between Text and Drawing - [8]
WTDKUACNrectangle and square shapes - [*]
BLWAYPKVextract a module - [*]
DRFE3B3Zmouse buttons are integers, not strings
Change contents
- edit in geom.lua at line 3
function geom.on_any_shape(x,y, drawing)for _,shape in ipairs(drawing.shapes) doassert(shape)if geom.on_shape(x,y, drawing, shape) thenreturn trueendendreturn falseend - replacement in geom.lua at line 27
return y >= y1*0.95 and y <= y2*1.05return y >= y1-2 and y <= y2+2 - replacement in geom.lua at line 34
return x >= x1*0.95 and x <= x2*1.05return x >= x1-2 and x <= x2+2 - replacement in geom.lua at line 40
return geom.dist(center.x,center.y, x,y) == shape.radiuslocal dist = geom.dist(center.x,center.y, x,y)return dist > shape.radius*0.95 and dist < shape.radius*1.05 - replacement in geom.lua at line 79
if math.abs(p1.x-x) > 5 thenif math.abs(p1.x-x) > 2 then - replacement in geom.lua at line 86
return y >= y1 and y <= y2return y >= y1-2 and y <= y2+2 - replacement in geom.lua at line 91
if yp < 0.95*y or yp > 1.05*y thenif yp < y-2 or yp > y+2 then - replacement in geom.lua at line 96
return k > -0.05 and k < 1.05return k > -0.005 and k < 1.005 - edit in drawing.lua at line 6
Show_nearby = false - edit in drawing.lua at line 33
if Show_nearby thenlove.graphics.setColor(1,0.75,0.75)for y=0,127 dofor x=0,255 doif geom.on_any_shape(x,y, line) thenlove.graphics.circle('fill', Drawing.pixels(x)+Margin_left, Drawing.pixels(y)+line.y, 2)endendendend - edit in drawing.lua at line 386[5.5258][11.1614]
if chord == 'C-a' thenShow_nearby = not Show_nearbyreturnend