dead code
[?]
Jun 15, 2022, 6:11 PM
VTYCPKNHTRN42MQ6IRGZDU6YLYXCPTUSUWVMMBOE7YC2H3UGK7EQCDependencies
- [2]
DRFE3B3Zmouse buttons are integers, not strings - [3]
XNFTJHC4split keyboard handling between Text and Drawing - [4]
NVSWVPW5move - [5]
H4K2GFILexperiment: give up on changing shape mode - [6]
2WGRQI5Emissing shape modes in a couple more places - [7]
VFJEVPPObugfix: function names - [8]
VHQCNMARseveral more modules - [9]
6UZ2JNZEyet another key conflict - [10]
JAXPXLEBset current_drawing_index with current_drawing - [11]
JFFUF5ALoverride mouse state lookups in tests - [12]
LAW2O3NWextract variable Margin_left - [*]
BLWAYPKVextract a module
Change contents
- edit in drawing.lua at line 471[3.9740]→[2.2554:2609](∅→∅),[2.2609]→[3.9926:10036](∅→∅),[3.3781]→[3.9926:10036](∅→∅),[3.9926]→[3.9926:10036](∅→∅)
elseif chord == 'C-s' and not App.mouse_down(1) thenlocal drawing,_,shape = Drawing.select_shape_at_mouse()if drawing thensmoothen(shape)end - edit in drawing.lua at line 651[3.21510]→[3.21510:22172](∅→∅),[3.22172]→[3.102:134](∅→∅),[3.134]→[3.22196:22708](∅→∅),[3.22196]→[3.22196:22708](∅→∅)
function Drawing.convert_line(drawing, shape)-- Perhaps we should do a more sophisticated "simple linear regression"-- here:-- https://en.wikipedia.org/wiki/Linear_regression#Simple_and_multiple_linear_regression-- But this works well enough for close-to-linear strokes.assert(shape.mode == 'freehand')shape.mode = 'line'shape.p1 = insert_point(drawing.points, shape.points[1].x, shape.points[1].y)local n = #shape.pointsshape.p2 = insert_point(drawing.points, shape.points[n].x, shape.points[n].y)end-- turn a line either horizontal or verticalfunction Drawing.convert_horvert(drawing, shape)if shape.mode == 'freehand' thenDrawing.convert_line(shape)endassert(shape.mode == 'line')local p1 = drawing.points[shape.p1]local p2 = drawing.points[shape.p2]if math.abs(p1.x-p2.x) > math.abs(p1.y-p2.y) thenp2.y = p1.yelsep2.x = p1.xendendfunction Drawing.smoothen(shape)assert(shape.mode == 'freehand')for _=1,7 dofor i=2,#shape.points-1 dolocal a = shape.points[i-1]local b = shape.points[i]local c = shape.points[i+1]b.x = (a.x + b.x + c.x)/3b.y = (a.y + b.y + c.y)/3endendend