extract a module
[?]
May 18, 2022, 2:41 AM
BLWAYPKV3MLDZ4ALXLUJ25AIR6PCIL4RFYNRYLB26GFVC2KQBYBACDependencies
- [2]
JS7DUFRA. - [3]
AVQ5MC5Dfinish uppercasing all globals - [4]
XX7G2FFJintermingle freehand line drawings with text - [5]
OTIBCAUJlove2d scaffold - [6]
JVRL5TWLstore device-independent coordinates inside drawings - [7]
KCIM5UTVrevert: back to freehand - [8]
2FMZNSD7experiment: only show drawing borders when they can be edited - [9]
VQFBNHU4make point near focus 'pop' - [10]
YHQC72JXslightly tweak boundary between concerns - [11]
XLDKEAFZmake sure to show the border of a drawing immediately after creating it - [12]
VVXVV2D2change data model; text can now have metadata - [13]
6LJZN727handle chords - [14]
CXCAERTBicons for current_mode - [15]
GCUARQ2Gbugfix: clipping in line and manhattan mode - [16]
G77XIN7Mselecting a stroke - [17]
6PUNJS5Bbackspace - [18]
Z2CJVAPVlighter border for figures - [19]
D2GCFTTTclean up repl functionality - [20]
TGICJQD3bugfix: move mode - [21]
VXORMHMEdelete experimental REPL - [22]
JCSLDGAHbeginnings of support for multiple shapes - [23]
O2UFJ6G3switch from freehand to just straight lines - [24]
FBDRL6LHdelete points or shapes - [25]
MNWHXPBLmore lightweight; select just the stroke at the mouse - [26]
3CS5KKCIup/down cursor movement - [27]
K6HMLFLZcolor close to drawing - [28]
T664AOUGmake points easier to acquire - [29]
JS6JSYOTonline contextual help - [30]
3SYFA5JQshow cursor even on empty lines - [31]
IFGAJAF7add a level of indirection to vertices of shapes - [32]
ZD63LJ2Tbugfix: keep the click to create a new drawing from creating a new shape in the drawing - [*]
R5QXEHUIsomebody stop me
Change contents
- edit in main.lua at line 1
local utf8 = require 'utf8' - replacement in main.lua at line 4
local utf8 = require 'utf8'local Drawing = require 'drawing' - edit in main.lua at line 120
-- line drawing - replacement in main.lua at line 121[4.426]→[4.2:62](∅→∅),[4.62]→[3.1084:1170](∅→∅),[4.82]→[4.156:203](∅→∅),[3.1170]→[4.156:203](∅→∅),[4.156]→[4.156:203](∅→∅),[4.203]→[3.1171:1347](∅→∅),[3.1347]→[4.92:105](∅→∅),[4.92]→[4.92:105](∅→∅),[4.105]→[3.1348:1409](∅→∅),[3.1409]→[4.161:173](∅→∅),[4.161]→[4.161:173](∅→∅),[4.173]→[4.2:146](∅→∅),[4.55]→[4.2:146](∅→∅),[4.55]→[4.279:289](∅→∅),[4.146]→[4.279:289](∅→∅),[4.279]→[4.279:289](∅→∅),[4.77]→[4.500:501](∅→∅),[4.289]→[4.500:501](∅→∅),[4.500]→[4.500:501](∅→∅),[4.501]→[4.147:248](∅→∅),[4.248]→[4.78:159](∅→∅),[4.501]→[4.78:159](∅→∅),[4.67]→[4.804:805](∅→∅),[4.159]→[4.804:805](∅→∅),[4.582]→[4.804:805](∅→∅),[4.804]→[4.804:805](∅→∅),[4.805]→[2.3:47](∅→∅),[2.47]→[4.47:69](∅→∅),[4.47]→[4.47:69](∅→∅),[4.69]→[4.98:143](∅→∅),[4.849]→[4.98:143](∅→∅),[4.41]→[4.45:138](∅→∅),[4.45]→[4.45:138](∅→∅),[4.75]→[4.45:138](∅→∅),[4.143]→[4.45:138](∅→∅),[4.625]→[4.45:138](∅→∅),[4.1307]→[4.45:138](∅→∅),[4.45]→[4.45:138](∅→∅),[4.280]→[4.280:292](∅→∅),[4.292]→[4.144:237](∅→∅),[4.237]→[4.3:340](∅→∅),[4.158]→[4.370:382](∅→∅),[4.340]→[4.370:382](∅→∅),[4.370]→[4.370:382](∅→∅),[4.159]→[4.1043:1053](∅→∅),[4.197]→[4.1043:1053](∅→∅),[4.292]→[4.1043:1053](∅→∅),[4.457]→[4.1043:1053](∅→∅),[4.1345]→[4.1043:1053](∅→∅),[4.1043]→[4.1043:1053](∅→∅),[4.189]→[4.458:500](∅→∅),[4.1053]→[4.458:500](∅→∅)
local pmx,pmy = love.mouse.getX(), love.mouse.getY()if pmx < 16+Drawing_width and pmy > line.y and pmy < line.y+pixels(line.h) thenlove.graphics.setColor(0.75,0.75,0.75)love.graphics.rectangle('line', 16,line.y, Drawing_width,pixels(line.h))if icon[Current_mode] thenicon[Current_mode](16+Drawing_width-20, line.y+4)elseicon[Previous_mode](16+Drawing_width-20, line.y+4)endif love.mouse.isDown('1') and love.keyboard.isDown('h') thendraw_help_with_mouse_pressed(line)returnendendif line.show_help thendraw_help_without_mouse_pressed(line)returnendlocal mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-line.y)for _,shape in ipairs(line.shapes) doassert(shape)if on_shape(mx,my, line, shape) thenlove.graphics.setColor(1,0,0)elselove.graphics.setColor(0,0,0)enddraw_shape(16,line.y, line, shape)endfor _,p in ipairs(line.points) doif p.deleted == nil thenif near(p, mx,my) thenlove.graphics.setColor(1,0,0)love.graphics.circle('line', pixels(p.x)+16,pixels(p.y)+line.y, 4)elselove.graphics.setColor(0,0,0)love.graphics.circle('fill', pixels(p.x)+16,pixels(p.y)+line.y, 2)endendenddraw_pending_shape(16,line.y, line)Drawing.draw(line, y) - file addition: drawing.lua[34.2]
-- primitives for editing drawingsDrawing = {}function Drawing.draw(line, y)local pmx,pmy = love.mouse.getX(), love.mouse.getY()if pmx < 16+Drawing_width and pmy > line.y and pmy < line.y+pixels(line.h) thenlove.graphics.setColor(0.75,0.75,0.75)love.graphics.rectangle('line', 16,line.y, Drawing_width,pixels(line.h))if icon[Current_mode] thenicon[Current_mode](16+Drawing_width-20, line.y+4)elseicon[Previous_mode](16+Drawing_width-20, line.y+4)endif love.mouse.isDown('1') and love.keyboard.isDown('h') thendraw_help_with_mouse_pressed(line)returnendendif line.show_help thendraw_help_without_mouse_pressed(line)returnendlocal mx,my = coord(love.mouse.getX()-16), coord(love.mouse.getY()-line.y)for _,shape in ipairs(line.shapes) doassert(shape)if on_shape(mx,my, line, shape) thenlove.graphics.setColor(1,0,0)elselove.graphics.setColor(0,0,0)enddraw_shape(16,line.y, line, shape)endfor _,p in ipairs(line.points) doif p.deleted == nil thenif near(p, mx,my) thenlove.graphics.setColor(1,0,0)love.graphics.circle('line', pixels(p.x)+16,pixels(p.y)+line.y, 4)elselove.graphics.setColor(0,0,0)love.graphics.circle('fill', pixels(p.x)+16,pixels(p.y)+line.y, 2)endendenddraw_pending_shape(16,line.y, line)endreturn Drawing