bugfix: keep the click to create a new drawing from creating a new shape in the drawing

[?]
May 14, 2022, 10:09 PM
ZD63LJ2TGWQQ5KWAX22QUWEYI2X5XUI2UTE4E7LGY26AS7HT2WGQC

Dependencies

  • [2] K6HMLFLZ color close to drawing
  • [3] JCSLDGAH beginnings of support for multiple shapes
  • [4] H7OEU6WP experimental approach to combining keyboard and mouse while drawing
  • [5] G77XIN7M selecting a stroke
  • [6] O2UFJ6G3 switch from freehand to just straight lines
  • [7] KCIM5UTV revert: back to freehand
  • [8] JVRL5TWL store device-independent coordinates inside drawings
  • [9] TRCAEE2A clip drawings inside the border
  • [10] HRWN5V6J Devine's suggestion to try to live with just freehand
  • [11] POT3XFCT rename
  • [12] 3XD6M3CF refactor
  • [13] OTIBCAUJ love2d scaffold
  • [14] XX7G2FFJ intermingle freehand line drawings with text
  • [15] EFMLTMZG bugfix: restrict strokes to the drawing they started in

Change contents

  • replacement in main.lua at line 85
    [2.48][5.426:500](),[5.426][5.426:500]()
    love.graphics.rectangle('line', 12,line.y, drawingw,pixels(line.h))
    [2.48]
    [5.500]
    love.graphics.rectangle('line', 16,line.y, drawingw,pixels(line.h))
  • replacement in main.lua at line 87
    [5.501][5.501:582]()
    local mx,my = coord(love.mouse.getX()-12), coord(love.mouse.getY()-line.y)
    [5.501]
    [5.804]
    local mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-line.y)
  • replacement in main.lua at line 95
    [5.292][3.1308:1345]()
    draw_shape(12,line.y, shape)
    [5.292]
    [5.1043]
    draw_shape(16,line.y, shape)
  • replacement in main.lua at line 97
    [5.1053][3.1346:1396]()
    draw_pending_shape(12,line.y, line.pending)
    [5.1053]
    [5.1240]
    draw_pending_shape(16,line.y, line.pending)
  • replacement in main.lua at line 117
    [5.60][5.856:957]()
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then
    [5.60]
    [3.1397]
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 16 and x < 16+drawingw then
  • replacement in main.lua at line 119
    [3.1450][3.1450:1570]()
    table.insert(drawing.pending.points, {x=coord(love.mouse.getX()-12), y=coord(love.mouse.getY()-drawing.y)})
    [3.1450]
    [3.1570]
    table.insert(drawing.pending.points, {x=coord(love.mouse.getX()-16), y=coord(love.mouse.getY()-drawing.y)})
  • replacement in main.lua at line 138
    [3.1855][3.1855:1902]()
    lines.current.pending.x2 = coord(x-12)
    [3.1855]
    [3.1902]
    lines.current.pending.x2 = coord(x-16)
  • replacement in main.lua at line 152
    [5.316][5.1069:1168]()
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then
    [5.316]
    [3.2115]
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 16 and x < 16+drawingw then
  • replacement in main.lua at line 154
    [3.2158][3.2158:2250]()
    drawing.pending = {mode='freehand', points={x=coord(x-12), y=coord(y-drawing.y)}}
    [3.2158]
    [3.2250]
    drawing.pending = {mode='freehand', points={x=coord(x-16), y=coord(y-drawing.y)}}
  • replacement in main.lua at line 156
    [3.2293][3.2293:2374]()
    drawing.pending = {mode='line', x1=coord(x-12), y1=coord(y-drawing.y)}
    [3.2293]
    [3.2374]
    drawing.pending = {mode='line', x1=coord(x-16), y1=coord(y-drawing.y)}
  • replacement in main.lua at line 287
    [4.640][4.640:739]()
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then
    [4.640]
    [4.739]
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 16 and x < 16+drawingw then
  • replacement in main.lua at line 299
    [4.955][4.955:1054]()
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then
    [4.955]
    [4.1054]
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 16 and x < 16+drawingw then
  • replacement in main.lua at line 311
    [5.292][5.1169:1354]()
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 12 and x < 12+drawingw then
    local mx,my = coord(love.mouse.getX()-12), coord(love.mouse.getY()-drawing.y)
    [5.292]
    [5.384]
    if y >= drawing.y and y < drawing.y + pixels(drawing.h) and x >= 16 and x < 16+drawingw then
    local mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-drawing.y)