about summary refs log tree commit diff stats
path: root/drawing.lua
Commit message (Collapse)AuthorAgeFilesLines
* bugfix: imprecision in drawingKartik K. Agaram2022-08-031-0/+3
| | | | | | | | | | | scenario: slowly press down mouse button and drag to draw a line release mouse button Before this commit the point would jump just a little bit on release, and points would go slightly to the left of where I expect. Yet another thing it's hard to write an automated test for.
* round one coordinateKartik K. Agaram2022-07-301-1/+1
|
* round coordinates to integers in a few placesKartik K. Agaram2022-07-291-7/+11
| | | | | | | | | | | | | Thanks Lion Kimbro for pointing out this issue. I still have to use floats for start/end angles of arcs. That might be a sign that I don't have the right serialization yet for them. Or that that feature needs to go. I started out with a hazy idea of only using 8-bit ints for coordinates, but now I'm not sure how committed I am to that constraint. While the width is always 256 units, it might be nice to create long portrait drawings at some point, whose height is greater than 256 units.
* bugfix: online helpKartik K. Agaram2022-07-221-2/+2
| | | | Broken in the commit before last.
* move drawing.starty into line cacheKartik K. Agaram2022-07-201-46/+57
|
* a more radical attempt at ignoring nil y'sKartik K. Agaram2022-07-131-4/+0
|
* no, bring back that defenseKartik K. Agaram2022-07-131-0/+4
| | | | | | | | | Scenario where I ran into it: start a stroke inside a drawing press 'o' to switch to circle mode (but any mode switch will do) The problem is that Text.textinput unconditionally blows away all .y values. Sometimes we have to wait for a draw() to fill them back in.
* a bug I've never run intoKartik K. Agaram2022-07-131-3/+0
| | | | | | The previous commit was failing inside a test that I can't reproduce manually. Perhaps it's something about how often draw/update run in practice. Anyways, it's definitely uncovered a real issue.
* hoist couple of variables outKartik K. Agaram2022-07-131-3/+6
| | | | This seems to uncover a corner case I'd never run into until now.
* use available variablesKartik K. Agaram2022-07-131-1/+1
|
* more idiomatic variable namesKartik K. Agaram2022-07-131-5/+5
|
* chunking by simple local variableKartik K. Agaram2022-07-131-4/+6
|
* make local functions look differentKartik K. Agaram2022-07-131-6/+6
|
* more chunks, same approachKartik K. Agaram2022-07-131-3/+6
|
* chunk up some long linesKartik K. Agaram2022-07-131-32/+32
| | | | | Hopefully this is more approachable. Though now I'm creating two new temporary functions on every draw. Whether I need them or not.
* drop final mention of state global beyond main.luaKartik K. Agaram2022-07-121-29/+28
| | | | | | | | | | This is all unfortunate in several ways - lots of functions have extra args - table lookups where we used to have a simple variable - program initialization is a lot more delicate Let's see if it was worthwhile. Can we now actually build around the editor component in forks?
* replace globals with args in a few functionsKartik K. Agaram2022-07-121-71/+74
| | | | | | | | | - Drawing.draw_shape - Drawing.draw_pending_shape - Drawing.in_drawing - Drawing.find_or_insert_point - Drawing.near - Drawing.pixels
* correct a mis-named thresholdKartik K. Agaram2022-07-121-2/+2
|
* drop heavyweight near check on file load/storeKartik K. Agaram2022-07-121-19/+25
|
* left/right margin -> left/right coordinatesKartik K. Agaram2022-07-121-34/+34
| | | | | Editor state initialization now depends on window dimensions, so we have to more carefully orchestrate startup.
* add state arg to a few functionsKartik K. Agaram2022-07-121-25/+25
| | | | | | | - Drawing.current_drawing - Drawing.select_shape_at_mouse - Drawing.select_point_at_mouse - Drawing.select_drawing_at_mouse
* add state arg to few functionsKartik K. Agaram2022-07-121-2/+2
| | | | | | - draw_help_without_mouse_pressed - draw_help_with_mouse_pressed - current_shape
* add state arg to Drawing.updateKartik K. Agaram2022-07-121-7/+7
|
* add state arg to Drawing.drawKartik K. Agaram2022-07-121-15/+15
|
* add state arg to Drawing.mouse_releasedKartik K. Agaram2022-07-121-20/+20
|
* add state arg to Drawing.keychord_pressedKartik K. Agaram2022-07-121-32/+32
|
* add state arg to Drawing.mouse_pressedKartik K. Agaram2022-07-121-15/+15
|
* group all editor globalsKartik K. Agaram2022-07-121-94/+94
| | | | We're still accessing them through a global. But we'll change that next.
* make colors easier to editKartik K. Agaram2022-07-111-7/+7
|
* stop pretending globals are localKartik K. Agaram2022-07-111-4/+0
| | | | | One advantage of this approach: we don't end up with multiple lexical scopes containing duplicates of the same modules.
* make freehand drawings smootherKartik K. Agaram2022-07-051-1/+17
| | | | | | | | | | | | Now I might actually use them more, and maybe I can start considering taking out some shapes. Do I really need circles if I don't provide ellipses? Thanks Ivan Reese for the feedback. "What drawings does your tool encourage?" Minor note: taking out the deepcopy creates a cute little string like effect, where the curve grows tighter the slower you draw it.
* bugfix: 'escape' to cancel a strokeKartik K. Agaram2022-07-051-1/+6
| | | | | | This has been broken since commit b544e8c357 on May 17 :/ I'm just undoing that commit, which turns out to be completely unnecessary. And adding a test.
* right marginKartik K. Agaram2022-06-301-7/+7
|
* rip out notion of Line_widthKartik K. Agaram2022-06-301-7/+7
|
* keep drawings within the line width slider as wellKartik K. Agaram2022-06-221-7/+7
|
* clean upKartik K. Agaram2022-06-171-17/+0
|
* more precise shape selectionKartik K. Agaram2022-06-171-0/+17
| | | | | | | It's important that the error be additive rather than multiplicative, otherwise the area grows asymmetrically along a line. Hopefully freehand drawings will work more intuitively now.
* correct commit f3abc2cbf2Kartik K. Agaram2022-06-171-7/+22
| | | | | | I can't be trusted to do anything without a test. This should fix #5. Please reopen if it doesn't.
* better handle moving pointsKartik K. Agaram2022-06-171-0/+5
| | | | | This should hopefully address #5. I'm removing some constraints from manhattan lines, rectangles and squares.
* dead codeKartik K. Agaram2022-06-151-45/+0
|
* moveKartik K. Agaram2022-06-151-28/+28
|
* .Kartik K. Agaram2022-06-151-6/+3
|
* stop recording points for arcsKartik K. Agaram2022-06-151-1/+0
| | | | | | It was kinda weird that we were recording the start but not the end. And moving the start point didn't actually affect the arc. Let's see if we actually ever need it.
* move current mode indicator slightlyKartik K. Agaram2022-06-151-2/+2
|
* standardize on ordering of casesKartik K. Agaram2022-06-151-9/+9
|
* test: moving a pointKartik K. Agaram2022-06-141-13/+4
| | | | | I found some code in the process that seems unreachable. Some chance of a regression here..
* tests for drawing polygonsKartik K. Agaram2022-06-141-1/+9
|
* start writing some tests for drawingsKartik K. Agaram2022-06-141-1/+3
|
* .Kartik K. Agaram2022-06-141-2/+2
|
* extract variable Margin_leftKartik K. Agaram2022-06-141-30/+30
|
521be3d2ec9e379b3baa974cb805386496d'>^
aec53ecd ^
4718a77c ^
1f56ac64 ^





87f72bee ^

1f56ac64 ^

87f72bee ^

1f56ac64 ^




f8bd7ed5 ^
87f72bee ^
f8bd7ed5 ^




87f72bee ^
















ad1068b3 ^




f8bd7ed5 ^









1f56ac64 ^

62197fd5 ^
3f4bbe9e ^
62197fd5 ^
1f56ac64 ^


1a62e61d ^
069ed1c8 ^
1f56ac64 ^




1a62e61d ^

1f56ac64 ^





a49bc413 ^
83c4fbc9 ^

a49bc413 ^
83c4fbc9 ^







a49bc413 ^





























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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391