move mouse_released events to Drawing
[?]
May 18, 2022, 5:55 AM
6DE7RBZ6RHNEICJ7EUMCTROK43LW4LYINULIF2QEQOKCXWLUYUXACDependencies
- [2]
EF6MFB46assume we always have a filename - [3]
HYEAFRZ2split mouse_pressed events between Text and Drawing - [4]
GCUARQ2Gbugfix: clipping in line and manhattan mode - [5]
AVQ5MC5Dfinish uppercasing all globals - [6]
HWPK4SMPnew mode: manhattan - [7]
SNDZOK6Qslightly less strange now that we have the same two ways to move points as any other operation - [8]
FMQ74DP3new mode: circle - [9]
NL5J7Z5Hnew mode: polygon - [10]
JCSLDGAHbeginnings of support for multiple shapes - [11]
ZOOY3ME4new mode: circle arc - [12]
OTIBCAUJlove2d scaffold - [13]
IFGAJAF7add a level of indirection to vertices of shapes - [14]
MGOQ5XAVstart uppercasing globals - [15]
VHQCNMARseveral more modules - [16]
YKRF5V3Zstarting to load/save - [17]
GP56QHRHbugfix - [18]
ZD63LJ2Tbugfix: keep the click to create a new drawing from creating a new shape in the drawing - [*]
BLWAYPKVextract a module
Change contents
- replacement in main.lua at line 173[4.1626]→[4.1723:1845](∅→∅),[4.1845]→[4.570:687](∅→∅),[4.2692]→[4.570:687](∅→∅),[4.301]→[4.570:687](∅→∅),[4.687]→[4.1739:1800](∅→∅),[4.1739]→[4.1739:1800](∅→∅),[4.1800]→[4.688:809](∅→∅),[4.809]→[4.1846:1922](∅→∅),[4.1922]→[4.869:943](∅→∅),[4.869]→[4.869:943](∅→∅),[4.943]→[4.1923:1993](∅→∅),[4.1993]→[4.1005:1112](∅→∅),[4.1005]→[4.1005:1112](∅→∅),[4.1112]→[4.440:452](∅→∅),[4.440]→[4.440:452](∅→∅),[4.452]→[4.1113:1239](∅→∅),[4.1239]→[4.1994:2070](∅→∅),[4.2070]→[4.1299:1373](∅→∅),[4.1299]→[4.1299:1373](∅→∅),[4.1373]→[4.527:583](∅→∅),[4.527]→[4.527:583](∅→∅),[4.583]→[4.2071:2146](∅→∅),[4.2146]→[4.1441:1482](∅→∅),[4.1441]→[4.1441:1482](∅→∅),[4.1482]→[4.691:706](∅→∅),[4.691]→[4.691:706](∅→∅),[4.706]→[4.2147:2222](∅→∅),[4.2222]→[4.1550:1591](∅→∅),[4.1550]→[4.1550:1591](∅→∅),[4.1591]→[4.814:828](∅→∅),[4.814]→[4.814:828](∅→∅),[4.828]→[4.1592:1660](∅→∅),[4.1660]→[4.2223:2319](∅→∅),[4.2319]→[4.1740:1808](∅→∅),[4.1740]→[4.1740:1808](∅→∅),[4.1044]→[4.464:476](∅→∅),[4.1808]→[4.464:476](∅→∅),[4.464]→[4.464:476](∅→∅),[4.476]→[4.1809:1867](∅→∅),[4.1867]→[4.2320:2396](∅→∅),[4.2396]→[4.1927:2001](∅→∅),[4.1927]→[4.1927:2001](∅→∅),[4.2001]→[4.2397:2467](∅→∅),[4.2467]→[4.2063:2131](∅→∅),[4.2063]→[4.2063:2131](∅→∅),[4.2131]→[4.325:337](∅→∅),[4.325]→[4.325:337](∅→∅),[4.337]→[4.2132:2255](∅→∅),[4.2255]→[4.2468:2544](∅→∅),[4.2544]→[4.2315:2610](∅→∅),[4.2315]→[4.2315:2610](∅→∅),[4.2610]→[4.415:427](∅→∅),[4.415]→[4.415:427](∅→∅),[4.427]→[4.2611:2665](∅→∅),[4.2665]→[4.2545:2621](∅→∅),[4.2621]→[4.2725:2875](∅→∅),[4.2725]→[4.2725:2875](∅→∅),[4.2875]→[4.2622:2746](∅→∅),[4.2746]→[4.2994:3062](∅→∅),[4.2994]→[4.2994:3062](∅→∅),[4.3062]→[4.454:466](∅→∅),[4.454]→[4.454:466](∅→∅),[4.403]→[4.1962:1972](∅→∅),[4.427]→[4.1962:1972](∅→∅),[4.466]→[4.1962:1972](∅→∅),[4.620]→[4.1962:1972](∅→∅),[4.630]→[4.1962:1972](∅→∅),[4.1962]→[4.1962:1972](∅→∅),[4.1972]→[4.3063:3122](∅→∅),[4.3122]→[4.2095:2103](∅→∅),[4.2095]→[4.2095:2103](∅→∅),[4.107]→[4.3110:3116](∅→∅),[4.1180]→[4.3110:3116](∅→∅),[4.1205]→[4.3110:3116](∅→∅),[4.1239]→[4.3110:3116](∅→∅),[4.1441]→[4.3110:3116](∅→∅),[4.1535]→[4.3110:3116](∅→∅),[4.3110]→[4.3110:3116](∅→∅),[4.3116]→[2.3:35](∅→∅)
if Current_drawing_mode == 'move' thenCurrent_drawing_mode = Previous_drawing_modePrevious_drawing_mode = nilelseif Lines.current thenif Lines.current.pending thenif Lines.current.pending.mode == 'freehand' then-- the last point added during update is good enoughtable.insert(Lines.current.shapes, Lines.current.pending)elseif Lines.current.pending.mode == 'line' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal j = Drawing.insert_point(Lines.current.points, mx,my)Lines.current.pending.p2 = jtable.insert(Lines.current.shapes, Lines.current.pending)endelseif Lines.current.pending.mode == 'manhattan' thenlocal p1 = Lines.current.points[Lines.current.pending.p1]local mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenif math.abs(mx-p1.x) > math.abs(my-p1.y) thenlocal j = Drawing.insert_point(Lines.current.points, mx, p1.y)Lines.current.pending.p2 = jelselocal j = Drawing.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+Drawing.pixels(p2.x), Lines.current.y+Drawing.pixels(p2.y))table.insert(Lines.current.shapes, Lines.current.pending)endelseif Lines.current.pending.mode == 'polygon' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal j = Drawing.insert_point(Lines.current.points, mx,my)table.insert(Lines.current.shapes, Lines.current.pending)endtable.insert(Lines.current.shapes, Lines.current.pending)elseif Lines.current.pending.mode == 'circle' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal center = Lines.current.points[Lines.current.pending.center]Lines.current.pending.radius = math.dist(center.x,center.y, mx,my)table.insert(Lines.current.shapes, Lines.current.pending)endelseif Lines.current.pending.mode == 'arc' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal center = Lines.current.points[Lines.current.pending.center]Lines.current.pending.end_angle = geom.angle_with_hint(center.x,center.y, mx,my, Lines.current.pending.end_angle)table.insert(Lines.current.shapes, Lines.current.pending)endendLines.current.pending = {}Lines.current = nilendendsave_to_disk(Lines, Filename)Drawing.mouse_released(x,y, button) - edit in drawing.lua at line 70
endfunction Drawing.mouse_released(x,y, button)if Current_drawing_mode == 'move' thenCurrent_drawing_mode = Previous_drawing_modePrevious_drawing_mode = nilelseif Lines.current thenif Lines.current.pending thenif Lines.current.pending.mode == 'freehand' then-- the last point added during update is good enoughtable.insert(Lines.current.shapes, Lines.current.pending)elseif Lines.current.pending.mode == 'line' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal j = Drawing.insert_point(Lines.current.points, mx,my)Lines.current.pending.p2 = jtable.insert(Lines.current.shapes, Lines.current.pending)endelseif Lines.current.pending.mode == 'manhattan' thenlocal p1 = Lines.current.points[Lines.current.pending.p1]local mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenif math.abs(mx-p1.x) > math.abs(my-p1.y) thenlocal j = Drawing.insert_point(Lines.current.points, mx, p1.y)Lines.current.pending.p2 = jelselocal j = Drawing.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+Drawing.pixels(p2.x), Lines.current.y+Drawing.pixels(p2.y))table.insert(Lines.current.shapes, Lines.current.pending)endelseif Lines.current.pending.mode == 'polygon' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal j = Drawing.insert_point(Lines.current.points, mx,my)table.insert(Lines.current.shapes, Lines.current.pending)endtable.insert(Lines.current.shapes, Lines.current.pending)elseif Lines.current.pending.mode == 'circle' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal center = Lines.current.points[Lines.current.pending.center]Lines.current.pending.radius = geom.dist(center.x,center.y, mx,my)table.insert(Lines.current.shapes, Lines.current.pending)endelseif Lines.current.pending.mode == 'arc' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-Lines.current.y)if mx >= 0 and mx < 256 and my >= 0 and my < Lines.current.h thenlocal center = Lines.current.points[Lines.current.pending.center]Lines.current.pending.end_angle = geom.angle_with_hint(center.x,center.y, mx,my, Lines.current.pending.end_angle)table.insert(Lines.current.shapes, Lines.current.pending)endendLines.current.pending = {}Lines.current = nilendendsave_to_disk(Lines, Filename)