Kartik K. Agaram f574a22794 | ||
---|---|---|
assets | ||
0000-freewheeling-start | ||
0001-on | ||
0002-Debug_animations_in_progress | ||
0002-vx | ||
0003-refresh_debug_animations | ||
0003-scale | ||
0004-on.update | ||
0004-vy | ||
0005-Cursor_node | ||
0005-animate | ||
0006-loiter | ||
0006-on.mouse_press | ||
0007-save_callstack | ||
0008-Debug_animation_period | ||
0008-Viewport | ||
0009-on.code_change | ||
0010-initialize_editor | ||
0011-box_height | ||
0012-on.initialize | ||
0013-font | ||
0014-y_of_schema1 | ||
0015-line_height | ||
0016-schema1_of_y | ||
0017-on.mouse_release | ||
0018-on.update | ||
0019-B | ||
0021-compute_layout | ||
0022-on.text_input | ||
0023-on.keychord_press | ||
0024-copy_shape | ||
0025-add_thick_line | ||
0026-on.draw | ||
0027-Surface | ||
0028-A | ||
0030-update_editor_box | ||
0031-Nodes | ||
0031-cols | ||
0032-rows | ||
0032-set_mouse_cursor | ||
0033-test_y_of_schema1 | ||
0034-dump_state | ||
0034-sx | ||
0035-pan_viewport_to_contain_cursor | ||
0035-sy | ||
0036-on_move_bar | ||
0037-on_resize | ||
0039-on_node | ||
0040-A1 | ||
0041-on_border | ||
0044-First_available_id | ||
0045-next_key | ||
0046-to_key | ||
0047-test_to_key | ||
0049-table.length | ||
0050-node_height | ||
0051-intersect_with_centroid | ||
0055-y_at_x | ||
0056-x_at_y | ||
0057-distance_sq | ||
0058-centroid | ||
0059-compute_layout_for_edge | ||
0060-Filename | ||
0061-on.quit | ||
0062-save_graph_to_disk | ||
0063-load_graph_from_disk | ||
0064-on.file_drop | ||
0065-on.load_settings | ||
0066-on.save_settings | ||
0067-Settings | ||
0068-table.copy | ||
0069-on_edge | ||
0070-detach_edge | ||
0071-table.remove_value | ||
0072-test_remove_value | ||
0074-on.resize | ||
0075-draw_grid | ||
0076-floor_to | ||
0077-base_for_zoom | ||
LICENSE.txt | ||
Manual_tests.md | ||
MemoryReferenceInfo.lua.0 | ||
MemoryReferenceInfo.lua.unused | ||
README.md | ||
app.lua | ||
button.lua | ||
default_map | ||
edit.lua | ||
file.lua | ||
json.lua | ||
keychord.lua | ||
live.lua | ||
main.lua | ||
nativefs.lua | ||
reference.md | ||
search.lua | ||
select.lua | ||
test.lua | ||
text.lua | ||
text_tests | ||
text_tests.lua | ||
undo.lua |
README.md
snap.love: a graph drawing tool
Unlike Graphviz and PlantUML, this tool is for small graphs where you want complete control over layout. Unlike PowerPoint or draw.io, this tool results generates text files that are more amenable to version control. The catch: it's a lot more limited than all these tools; all you can do so far is draw rectangles and edges between them.
You can't change the styling. Unless you modify the code. But that's easy! This repo is an example of a Freewheeling App, designed above all to be easy to run, easy to modify and easy to share.
Getting started
Install LÖVE. It's just a 5MB download, open-source and extremely well-behaved.
You'll see a single box on screen. Drag the surface or press arrow keys to pan around. Try dragging the border of the box. You'll see an edge stick out. Release the mouse button, and a new box (node) will pop out at the other end of the edge. Try dragging the top-left bar for each box. They move relative to each other. Try typing inside. The text wraps within and the box grows taller to accomodate it. Try dragging the parallel lines to the right of a box. The width of the box changes.
Try quitting and restarting. Your changes will still be present. By default,
snap.love writes to a file called graph
in a directory relative to this app.
To switch to a different file, drop it on the snap.love window. You can also
pass in a filename when starting the app from the terminal.
Hacking
To make changes to this app without restarting the app each time, download the driver app. Example session:
Some reference documentation on how to create your own apps.
If the app being modified by the driver lives in a .love file, your changes will go into the save directory. If it lives in a directory (like this repo), your changes will go straight into the same directory.
Keyboard shortcuts
While editing within a node:
ctrl+f
to find patternsctrl+c
to copy,ctrl+x
to cut,ctrl+v
to pastectrl+z
to undo,ctrl+y
to redoctrl+=
to zoom in,ctrl+-
to zoom out,ctrl+0
to reset zoomalt+right
/alt+left
to jump to the next/previous word, respectively- mouse drag or
shift
+ movement to select text,ctrl+a
to select all
When cursor is not in an editor:
- arrow keys pan the surface
shift
+arrow keys pan fasterpagedown
andpageup
are aliases forshift+down
andshift+up
respectively
Exclusively tested so far with a US keyboard layout. If you use a different layout, please let me know if things worked, or if you found anything amiss: http://akkartik.name/contact
Known issues
- No scrollbars yet. That stuff is hard.
Mirrors and Forks
This repo is a fork of lines.love, an editor for plain text where you can also seamlessly insert line drawings. Its immediate upstream is luaML.love, a box model for a Lua-based markup language that models an infinite pannable, zoomable 2D surface. Updates to it can be downloaded from:
- https://git.sr.ht/~akkartik/snap.love
- https://tildegit.org/akkartik/snap.love
- https://git.merveilles.town/akkartik/snap.love
- https://nest.pijul.com/akkartik/snap.love (using the Pijul version control system)
Further forks are encouraged. If you show me your fork, I'll link to it here.
- https://git.sr.ht/~akkartik/wardley.love - a little tool for building Wardley Maps
Feedback
Most appreciated. Messages, PRs, patches, forks, it's all good.