Kartik K. Agaram
0ac44f0756
formatting
2022-07-16 19:27:58 -07:00
Kartik K. Agaram
f61d4269f5
bring back a set of constants
...
It's starting to sink in that I don't want hard-coded constants inside
objects.
2022-07-16 08:48:02 -07:00
Kartik K. Agaram
c26b377ab3
more decoupling editor tests from App
2022-07-16 08:33:05 -07:00
Kartik K. Agaram
a2b654b534
more decoupling editor tests from App
2022-07-16 08:27:11 -07:00
Kartik K. Agaram
51b4efa59a
more decoupling editor tests from App
2022-07-16 08:20:47 -07:00
Kartik K. Agaram
a1da18c107
more precise name
2022-07-15 22:15:07 -07:00
Kartik K. Agaram
2884f872d8
make test initializations a little more obvious
2022-07-15 22:12:25 -07:00
Kartik K. Agaram
fc6b602342
bugfix: zoom in/out hotkeys
...
Broken since commit 3b36093553
5 hours ago.
2022-07-13 23:31:52 -07:00
Kartik K. Agaram
119abbd52e
bugfix: resize
2022-07-13 15:40:14 -07:00
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
75ec5c9087
.
2022-07-12 22:13:06 -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
2ae9cacd97
deduce left/right from state where possible
2022-07-12 20:59:24 -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
f7d4deef0c
add state arg to a few functions
...
- Text.cursor_at_final_screen_line
- Text.move_cursor_down_to_next_text_line_while_scrolling_again_if_necessary
- Text.snap_cursor_to_bottom_of_screen
- Text.in_line
- Text.to_pos_on_line
- Text.to2
- Text.to1
- Text.previous_screen_line
- Text.tweak_screen_top_and_cursor
- Text.redraw_all
2022-07-12 17:24:01 -07:00
Kartik K. Agaram
2b1889353b
add state arg to a few functions
...
- Text.pos_at_start_of_cursor_screen_line
- Text.cursor_past_screen_bottom
2022-07-12 17:14:14 -07:00
Kartik K. Agaram
5107df3cd0
add state arg to a few functions
...
- Text.left
- Text.right
- Text.right_without_scroll
2022-07-12 17:10:11 -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
5aae527759
add state arg to a few functions
...
- Text.search_next
- Text.search_previous
2022-07-12 17:02:53 -07:00
Kartik K. Agaram
5b91af1a66
add state arg to a few functions
...
- record_undo_event
- undo_event
- redo_event
- snapshot
2022-07-12 16:55:32 -07:00
Kartik K. Agaram
188bbc73cc
add state arg to a few functions
...
- Text.draw_highlight
- Text.clip_selection
- Text.selection
- Text.cut_selection
- Text.delete_selection
- Text.delete_selection_without_undo
- Text.mouse_pos
- Text.to_pos
2022-07-12 16:51:18 -07:00
Kartik K. Agaram
800a5c064a
add state arg to a few functions
...
- Text.insert_at_cursor
- Text.insert_return
- Text.pageup
- Text.pagedown
- Text.up
- Text.down
- Text.start_of_line
- Text.end_of_line
- Text.word_left
- Text.word_right
2022-07-12 16:39:42 -07:00
Kartik K. Agaram
adeb5416c6
add state arg to Text.textinput
2022-07-12 16:33:26 -07:00
Kartik K. Agaram
b7000215d8
add state arg to schedule_save
2022-07-12 16:30:41 -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
93aca28cb3
add state arg to Text.keychord_pressed
2022-07-12 16:23:28 -07:00
Kartik K. Agaram
cb5524ec58
.
2022-07-12 16:22:35 -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
3874f325f8
add state arg to some functions
...
- Text.draw
- Text.draw_cursor
- Text.draw_search_bar
2022-07-12 16:20:20 -07:00
Kartik K. Agaram
92ad99853e
call edit rather than App callbacks in tests
2022-07-12 15:41:17 -07:00
Kartik K. Agaram
81ecca89ff
start passing in Editor_state explicitly
...
In this commit, top-level edit functions:
- edit.draw
- edit.update
- edit.quit
- edit.mouse_pressed
- edit.mouse_released
- edit.textinput
- edit.keychord_pressed
- edit.key_released
2022-07-12 15:33:06 -07:00
Kartik K. Agaram
e95b4fec12
initialize contains test state
2022-07-12 15:29:22 -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
a5f725ab3b
bring couple more globals back to the app level
2022-07-12 13:45:38 -07:00