about summary refs log tree commit diff stats
path: root/drawing.lua
diff options
context:
space:
mode:
Diffstat (limited to 'drawing.lua')
-rw-r--r--drawing.lua20
1 files changed, 20 insertions, 0 deletions
diff --git a/drawing.lua b/drawing.lua
index 9592587..fad062f 100644
--- a/drawing.lua
+++ b/drawing.lua
@@ -49,6 +49,26 @@ function Drawing.draw(line, y)
   Drawing.draw_pending_shape(16,line.y, line)
 end
 
+function Drawing.in_drawing(drawing, x,y)
+  return y >= drawing.y and y < drawing.y + Drawing.pixels(drawing.h) and x >= 16 and x < 16+Drawing_width
+end
+
+function Drawing.mouse_pressed(drawing, x,y, button)
+  if Current_drawing_mode == 'freehand' then
+    drawing.pending = {mode=Current_drawing_mode, points={{x=Drawing.coord(x-16), y=Drawing.coord(y-drawing.y)}}}
+  elseif Current_drawing_mode == 'line' or Current_drawing_mode == 'manhattan' then
+    local j = Drawing.insert_point(drawing.points, Drawing.coord(x-16), Drawing.coord(y-drawing.y))
+    drawing.pending = {mode=Current_drawing_mode, p1=j}
+  elseif Current_drawing_mode == 'polygon' then
+    local j = Drawing.insert_point(drawing.points, Drawing.coord(x-16), Drawing.coord(y-drawing.y))
+    drawing.pending = {mode=Current_drawing_mode, vertices={j}}
+  elseif Current_drawing_mode == 'circle' then
+    local j = Drawing.insert_point(drawing.points, Drawing.coord(x-16), Drawing.coord(y-drawing.y))
+    drawing.pending = {mode=Current_drawing_mode, center=j}
+  end
+  Lines.current = drawing
+end
+
 function Drawing.keychord_pressed(chord)
   if chord == 'C-=' then
     Drawing_width = Drawing_width/Zoom
/akspecs/aerc/commit/widgets/aerc.go?h=0.4.0&id=b60999c39e11bf4d1e236f2b10a2f895b44d23fb'>b60999c ^
c286d3d ^

cab3771 ^

b60999c ^


cab3771 ^
cab3771 ^
1c41b63 ^
1265d9c ^

cab3771 ^
1265d9c ^

cab3771 ^

1c41b63 ^

cab3771 ^
80e891a ^
1c41b63 ^

cab3771 ^
8492a21 ^

b60999c ^
8492a21 ^


b76deea ^
648ca98 ^
24dfc47 ^
8492a21 ^
0911cd5 ^
1c41b63 ^
cab3771 ^
8492a21 ^
cab3771 ^

607ece8 ^
1228448 ^


cab3771 ^
b76deea ^


cab3771 ^









80e891a ^
c286d3d ^

cab3771 ^
8492a21 ^
b60999c ^

8492a21 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81