delegate update events to drawings
[?]
May 18, 2022, 6:16 AM
RT6EV6OPUYCXYZOX2PHFXJ7KT77KHNEVINEGQXIQLHQVKPGTN6VQCDependencies
- [2]
6DE7RBZ6move mouse_released events to Drawing - [3]
3RGHOJ25DRY some code - [4]
WDWXNW7Vslightly strange way to move points - [5]
POT3XFCTrename - [6]
JVRL5TWLstore device-independent coordinates inside drawings - [7]
MNWHXPBLmore lightweight; select just the stroke at the mouse - [8]
JCSLDGAHbeginnings of support for multiple shapes - [9]
MGOQ5XAVstart uppercasing globals - [10]
OTIBCAUJlove2d scaffold - [11]
KVHUFUFVreorg - [12]
VHQCNMARseveral more modules - [13]
NCRKBTHCposition cursor more precisely - [14]
AVQ5MC5Dfinish uppercasing all globals - [15]
KCIM5UTVrevert: back to freehand - [16]
G77XIN7Mselecting a stroke - [17]
QU7NHFOVshow cursor - [18]
L5USRTY2inline - [19]
IYW7X3WLleft/right cursor movement, deleting characters - [20]
XX7G2FFJintermingle freehand line drawings with text - [21]
IZZVOCLBconfirm that we have access to all of the love API - [22]
EFMLTMZGbugfix: restrict strokes to the drawing they started in - [*]
BLWAYPKVextract a module
Change contents
- replacement in main.lua at line 129[4.446]→[3.3:165](∅→∅),[3.165]→[4.76:109](∅→∅),[4.446]→[4.76:109](∅→∅),[4.109]→[3.166:599](∅→∅),[3.599]→[4.1659:1677](∅→∅),[4.1659]→[4.1659:1677](∅→∅),[4.1677]→[4.501:546](∅→∅),[4.546]→[3.600:646](∅→∅),[3.646]→[4.657:725](∅→∅),[4.657]→[4.657:725](∅→∅),[4.725]→[4.298:390](∅→∅),[4.298]→[4.298:390](∅→∅),[4.390]→[4.1677:1683](∅→∅),[4.1677]→[4.1677:1683](∅→∅)
if Lines.current == nil then return endlocal drawing = Lines.currentassert(drawing.mode == 'drawing')local x, y = love.mouse.getX(), love.mouse.getY()if love.mouse.isDown('1') thenif Drawing.in_drawing(drawing, x,y) thenif drawing.pending.mode == 'freehand' thentable.insert(drawing.pending.points, {x=Drawing.coord(love.mouse.getX()-16), y=Drawing.coord(love.mouse.getY()-drawing.y)})elseif drawing.pending.mode == 'move' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y)drawing.pending.target_point.x = mxdrawing.pending.target_point.y = myendendelseif Current_drawing_mode == 'move' thenif Drawing.in_drawing(drawing, x, y) thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y)drawing.pending.target_point.x = mxdrawing.pending.target_point.y = myendendDrawing.update(dt) - edit in drawing.lua at line 72
-- a couple of operations on drawings need to constantly check the state of the mousefunction Drawing.update()if Lines.current == nil then return endlocal drawing = Lines.currentassert(drawing.mode == 'drawing')local x, y = love.mouse.getX(), love.mouse.getY()if love.mouse.isDown('1') thenif Drawing.in_drawing(drawing, x,y) thenif drawing.pending.mode == 'freehand' thentable.insert(drawing.pending.points, {x=Drawing.coord(love.mouse.getX()-16), y=Drawing.coord(love.mouse.getY()-drawing.y)})elseif drawing.pending.mode == 'move' thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y)drawing.pending.target_point.x = mxdrawing.pending.target_point.y = myendendelseif Current_drawing_mode == 'move' thenif Drawing.in_drawing(drawing, x, y) thenlocal mx,my = Drawing.coord(x-16), Drawing.coord(y-drawing.y)drawing.pending.target_point.x = mxdrawing.pending.target_point.y = myendendend