Kartik K. Agaram
e4f9d50a55
a more radical attempt at ignoring nil y's
2022-07-13 09:31:54 -07:00
Kartik K. Agaram
d231f4d37d
no, bring back that defense
...
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.
2022-07-13 09:21:19 -07:00
Kartik K. Agaram
22ad5373c5
a bug I've never run into
...
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.
2022-07-13 08:40:04 -07:00
Kartik K. Agaram
6659de60f3
hoist couple of variables out
...
This seems to uncover a corner case I'd never run into until now.
2022-07-13 08:24:16 -07:00
Kartik K. Agaram
3b1f2cf9de
use available variables
2022-07-13 08:19:58 -07:00
Kartik K. Agaram
5017659bf4
more idiomatic variable names
2022-07-13 08:19:06 -07:00
Kartik K. Agaram
457136a986
chunking by simple local variable
2022-07-13 08:14:01 -07:00
Kartik K. Agaram
9f962b7cac
make local functions look different
2022-07-13 08:04:06 -07:00
Kartik K. Agaram
cfa04c3ca1
more chunks, same approach
2022-07-13 08:02:41 -07:00
Kartik K. Agaram
5a04d0c221
chunk up some long lines
...
Hopefully this is more approachable. Though now I'm creating two new
temporary functions on every draw. Whether I need them or not.
2022-07-13 07:50:50 -07:00
Kartik K. Agaram
9e9e8ed35c
drop final mention of state global beyond main.lua
...
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?
2022-07-12 22:05:53 -07:00
Kartik K. Agaram
70a15b3bc9
replace globals with args in a few functions
...
- Drawing.draw_shape
- Drawing.draw_pending_shape
- Drawing.in_drawing
- Drawing.find_or_insert_point
- Drawing.near
- Drawing.pixels
2022-07-12 21:58:46 -07:00
Kartik K. Agaram
307e875c1c
correct a mis-named threshold
2022-07-12 21:41:09 -07:00
Kartik K. Agaram
3dd5413dbf
drop heavyweight near check on file load/store
2022-07-12 21:29:30 -07:00
Kartik K. Agaram
3b36093553
left/right margin -> left/right coordinates
...
Editor state initialization now depends on window dimensions, so we have
to more carefully orchestrate startup.
2022-07-12 20:54:50 -07:00
Kartik K. Agaram
1ede1c3c6d
add state arg to a few functions
...
- Drawing.current_drawing
- Drawing.select_shape_at_mouse
- Drawing.select_point_at_mouse
- Drawing.select_drawing_at_mouse
2022-07-12 17:27:00 -07:00
Kartik K. Agaram
674d571576
add state arg to few functions
...
- draw_help_without_mouse_pressed
- draw_help_with_mouse_pressed
- current_shape
2022-07-12 17:05:21 -07:00
Kartik K. Agaram
e990b1be92
add state arg to Drawing.update
2022-07-12 16:26:00 -07:00
Kartik K. Agaram
2307cb3ded
add state arg to Drawing.draw
2022-07-12 16:25:29 -07:00
Kartik K. Agaram
d6795f9df0
add state arg to Drawing.mouse_released
2022-07-12 16:21:56 -07:00
Kartik K. Agaram
780105cb13
add state arg to Drawing.keychord_pressed
2022-07-12 16:21:03 -07:00
Kartik K. Agaram
d7ee9a75e4
add state arg to Drawing.mouse_pressed
2022-07-12 16:20:25 -07:00
Kartik K. Agaram
8bbc1ffe34
group all editor globals
...
We're still accessing them through a global. But we'll change that next.
2022-07-12 15:24:56 -07:00
Kartik K. Agaram
3850fbac35
make colors easier to edit
2022-07-11 23:18:26 -07:00
Kartik K. Agaram
3dccd7f81a
stop pretending globals are local
...
One advantage of this approach: we don't end up with multiple lexical
scopes containing duplicates of the same modules.
2022-07-11 22:11:58 -07:00
Kartik K. Agaram
26a98d027b
make freehand drawings smoother
...
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.
2022-07-05 11:38:08 -07:00
Kartik K. Agaram
3422d92a00
bugfix: 'escape' to cancel a stroke
...
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.
2022-07-05 11:06:55 -07:00
Kartik K. Agaram
429a42eb1c
right margin
2022-06-30 22:54:34 -07:00
Kartik K. Agaram
8c7bea8f76
rip out notion of Line_width
2022-06-30 19:50:27 -07:00
Kartik K. Agaram
515dad95f9
keep drawings within the line width slider as well
2022-06-22 21:08:17 -07:00
Kartik K. Agaram
97bbc7da7f
clean up
2022-06-17 23:16:49 -07:00
Kartik K. Agaram
0248339898
more precise shape selection
...
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.
2022-06-17 23:15:09 -07:00
Kartik K. Agaram
26995dd62e
correct commit f3abc2cbf2
...
I can't be trusted to do anything without a test.
This should fix #5 . Please reopen if it doesn't.
2022-06-17 22:53:05 -07:00
Kartik K. Agaram
f3abc2cbf2
better handle moving points
...
This should hopefully address #5 . I'm removing some constraints from
manhattan lines, rectangles and squares.
2022-06-17 21:40:59 -07:00
Kartik K. Agaram
bed0ddd2b7
dead code
2022-06-15 11:11:06 -07:00
Kartik K. Agaram
b1ee70d62c
move
2022-06-15 11:10:30 -07:00
Kartik K. Agaram
9644b066bd
.
2022-06-15 09:59:18 -07:00
Kartik K. Agaram
d77bcd8f8c
stop recording points for arcs
...
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.
2022-06-15 09:57:49 -07:00
Kartik K. Agaram
4280b19cac
move current mode indicator slightly
2022-06-15 09:03:31 -07:00
Kartik K. Agaram
a40d2c424e
standardize on ordering of cases
2022-06-15 08:53:34 -07:00
Kartik K. Agaram
93a9dfd364
test: moving a point
...
I found some code in the process that seems unreachable. Some chance of
a regression here..
2022-06-14 21:08:07 -07:00
Kartik K. Agaram
2b4e14189b
tests for drawing polygons
2022-06-14 14:59:09 -07:00
Kartik K. Agaram
dc3b18eb6c
start writing some tests for drawings
2022-06-14 10:50:14 -07:00
Kartik K. Agaram
8c535dbb3a
.
2022-06-14 10:50:14 -07:00
Kartik K. Agaram
f277a78455
extract variable Margin_left
2022-06-14 10:49:06 -07:00
Kartik K. Agaram
c1d8201d44
mouse buttons are integers, not strings
...
Not sure where that idiom comes from or why strings work in some places
(auto-coercion?). I picked it up off some example apps. But
https://love2d.org/wiki/love.mouse.isDown says it should be an integer.
2022-06-14 09:05:02 -07:00
Kartik K. Agaram
059efba79d
override mouse state lookups in tests
...
If I'd had this stuff in my test harness earlier, two recent commits
would have failed tests and given me early warning:
ff88238ff1
ff88a2a927
2022-06-12 09:04:21 -07:00
Kartik K. Agaram
242a087016
set current_drawing_index with current_drawing
2022-06-10 13:44:12 -07:00
Kartik K. Agaram
fcfe667fe9
include drawing index in a few places
2022-06-10 13:40:07 -07:00
Kartik K. Agaram
c875f7be46
stop saving the entire file when modifying drawings
...
Now we just disallow that entirely.
2022-06-10 11:48:32 -07:00