bugfix: clipping in line and manhattan mode

[?]
May 15, 2022, 1:40 AM
GCUARQ2GJT3Y5K6LOOA6S7SOBMSXU7VV7LT355TOMFFPBQ3ZVYKAC

Dependencies

  • [2] HWPK4SMP new mode: manhattan
  • [3] Z2CJVAPV lighter border for figures
  • [4] YHQC72JX slightly tweak boundary between concerns
  • [5] EFMLTMZG bugfix: restrict strokes to the drawing they started in
  • [6] ZD63LJ2T bugfix: keep the click to create a new drawing from creating a new shape in the drawing
  • [7] MNWHXPBL more lightweight; select just the stroke at the mouse
  • [8] O2UFJ6G3 switch from freehand to just straight lines
  • [9] KCIM5UTV revert: back to freehand
  • [10] XX7G2FFJ intermingle freehand line drawings with text
  • [11] OTIBCAUJ love2d scaffold
  • [12] JVRL5TWL store device-independent coordinates inside drawings
  • [13] JCSLDGAH beginnings of support for multiple shapes
  • [14] G77XIN7M selecting a stroke
  • [15] IFGAJAF7 add a level of indirection to vertices of shapes
  • [*] 3XD6M3CF refactor

Change contents

  • replacement in main.lua at line 89
    [3.84][3.805:849](),[3.805][3.805:849]()
    for _,shape in ipairs(line.shapes) do
    [3.805]
    [3.98]
    for i,shape in ipairs(line.shapes) do
    assert(shape)
  • edit in main.lua at line 148
    [3.1800]
    [3.1800]
    table.insert(lines.current.shapes, lines.current.pending)
  • replacement in main.lua at line 150
    [3.1855][3.501:630]()
    local j = insert_point(lines.current.points, coord(x-16), coord(y-lines.current.y))
    lines.current.pending.p2 = j
    [3.1855]
    [2.3]
    local mx,my = coord(x-16), coord(y-lines.current.y)
    if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
    local j = insert_point(lines.current.points, mx,my)
    lines.current.pending.p2 = j
    table.insert(lines.current.shapes, lines.current.pending)
    end
  • replacement in main.lua at line 159
    [2.189][2.189:464]()
    if math.abs(mx-p1.x) > math.abs(my-p1.y) then
    local j = insert_point(lines.current.points, mx, p1.y)
    lines.current.pending.p2 = j
    else
    local j = insert_point(lines.current.points, p1.x, my)
    lines.current.pending.p2 = j
    [2.189]
    [2.464]
    if mx >= 0 and mx < 256 and my >= 0 and my < lines.current.h then
    if math.abs(mx-p1.x) > math.abs(my-p1.y) then
    local j = insert_point(lines.current.points, mx, p1.y)
    lines.current.pending.p2 = j
    else
    local j = insert_point(lines.current.points, p1.x, my)
    lines.current.pending.p2 = j
    end
    local p2 = lines.current.points[lines.current.pending.p2]
    love.mouse.setPosition(16+pixels(p2.x), lines.current.y+pixels(p2.y))
    table.insert(lines.current.shapes, lines.current.pending)
  • edit in main.lua at line 171
    [2.476][2.476:620]()
    local p2 = lines.current.points[lines.current.pending.p2]
    love.mouse.setPosition(16+pixels(p2.x), lines.current.y+pixels(p2.y))
  • edit in main.lua at line 172
    [3.1972][3.1972:2036]()
    table.insert(lines.current.shapes, lines.current.pending)
  • replacement in main.lua at line 233
    [3.1345][3.1345:1441]()
    love.graphics.line(pixels(p1.x)+left,pixels(p1.y)+top, love.mouse.getX(),love.mouse.getY())
    [3.1345]
    [2.761]
    local mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-drawing.y)
    if mx < 0 or mx >= 256 or my < 0 or my >= drawing.h then
    return
    end
    love.graphics.line(pixels(p1.x)+left,pixels(p1.y)+top, pixels(mx)+left,pixels(my)+top)
  • edit in main.lua at line 241
    [2.923]
    [2.923]
    if mx < 0 or mx >= 256 or my < 0 or my >= drawing.h then
    return
    end
  • edit in main.lua at line 395
    [17.433]
    [3.3419]
    assert(shape)