new mode: manhattan
[?]
May 14, 2022, 11:52 PM
HWPK4SMPGZMXWXKCVX667676ZWN5Q2XZSTMVAADG7JNRF6XE45RQCDependencies
- [2]
S5JIPJPI. - [3]
IFGAJAF7add a level of indirection to vertices of shapes - [4]
EFMLTMZGbugfix: restrict strokes to the drawing they started in - [5]
JCSLDGAHbeginnings of support for multiple shapes - [6]
ZD63LJ2Tbugfix: keep the click to create a new drawing from creating a new shape in the drawing - [*]
OTIBCAUJlove2d scaffold - [*]
KCIM5UTVrevert: back to freehand - [*]
T76KKDWZturn strokes into horizontal and vertical lines
Change contents
- edit in main.lua at line 150
elseif lines.current.pending.mode == 'manhattan' thenlocal p1 = lines.current.points[lines.current.pending.p1]local mx,my = coord(x-16), coord(y-lines.current.y)if math.abs(mx-p1.x) > math.abs(my-p1.y) thenlocal j = insert_point(lines.current.points, mx, p1.y)lines.current.pending.p2 = jelselocal j = insert_point(lines.current.points, p1.x, my)lines.current.pending.p2 = jendlocal p2 = lines.current.points[lines.current.pending.p2]love.mouse.setPosition(16+pixels(p2.x), lines.current.y+pixels(p2.y)) - replacement in main.lua at line 177
elseif current_mode == 'line' thenelseif current_mode == 'line' or current_mode == 'manhattan' then - replacement in main.lua at line 212
elseif shape.mode == 'line' thenelseif shape.mode == 'line' or shape.mode == 'manhattan' then - edit in main.lua at line 226
elseif shape.mode == 'manhattan' thenlocal p1 = drawing.points[shape.p1]local mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-drawing.y)if math.abs(mx-p1.x) > math.abs(my-p1.y) thenlove.graphics.line(pixels(p1.x)+left,pixels(p1.y)+top, pixels(mx)+left,pixels(p1.y)+top)elselove.graphics.line(pixels(p1.x)+left,pixels(p1.y)+top, pixels(p1.x)+left,pixels(my)+top)end - edit in main.lua at line 242
elseif shape.mode == 'manhattan' thenreturn x == drawing.points[shape.p1].x or y == drawing.points[shape.p1].y - edit in main.lua at line 245
print(shape.mode) - edit in main.lua at line 331[9.1022][10.11]
elseif love.mouse.isDown('1') and chord == 'm' thencurrent_mode = 'manhattan'local drawing = select_drawing_at_mouse()drawing.pending.mode = 'manhattan' - edit in main.lua at line 336[10.40][10.40]
current_mode = 'manhattan' - edit in main.lua at line 389
function select_drawing_at_mouse()for _,drawing in ipairs(lines) doif type(drawing) == 'table' thenlocal x, y = love.mouse.getX(), love.mouse.getY()if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 16 and x < 16+drawingw thenreturn drawingendendendend