new fork: show raw text for drawing below it
https://merveilles.town/@maleza/109398870908062135 Lots of issues: * can't edit the raw text * ..but it confusingly displays a second cursor * raw text doesn't update when drawing (need to constantly deserialize the drawing to JSON) * ... lots of others This is an early experiment.
This commit is contained in:
parent
44aa8226c4
commit
0075298a29
29
README.md
29
README.md
|
@ -6,6 +6,9 @@ modifications break something.
|
|||
|
||||
http://akkartik.name/lines.html
|
||||
|
||||
This (currently incomplete) fork experiments with showing the raw text for a
|
||||
drawing below it.
|
||||
|
||||
## Invocation
|
||||
|
||||
To run from the terminal, [pass this directory to LÖVE](https://love2d.org/wiki/Getting_Started#Running_Games),
|
||||
|
@ -84,30 +87,12 @@ found anything amiss: http://akkartik.name/contact
|
|||
|
||||
## Mirrors and Forks
|
||||
|
||||
Updates to lines.love can be downloaded from the following mirrors in addition
|
||||
to the website above:
|
||||
* https://github.com/akkartik/lines.love
|
||||
* https://repo.or.cz/lines.love.git
|
||||
* https://codeberg.org/akkartik/lines.love
|
||||
* https://tildegit.org/akkartik/lines.love
|
||||
* https://git.tilde.institute/akkartik/lines.love
|
||||
* https://git.sr.ht/~akkartik/lines.love
|
||||
* https://notabug.org/akkartik/lines.love
|
||||
* https://pagure.io/lines.love
|
||||
This repo is a fork of [lines.love](http://akkartik.name/lines.html). Updates
|
||||
to it can be downloaded from:
|
||||
|
||||
Forks of lines.love are encouraged. If you show me your fork, I'll link to it
|
||||
here.
|
||||
* https://tildegit.org/akkartik/lines-maleza-experiment
|
||||
|
||||
* https://github.com/akkartik/lines-polygon-experiment -- an experiment that
|
||||
uses separate shortcuts for regular polygons. `ctrl+3` for triangles,
|
||||
`ctrl+4` for squares, etc.
|
||||
* https://codeberg.org/akkartik/text.love -- a stripped down version without
|
||||
drawings; useful starting point for some forks
|
||||
* https://git.sr.ht/~akkartik/pensieve.love -- a note-taking app on an
|
||||
infinite 2D surface. Still in development.
|
||||
* https://git.sr.ht/~akkartik/capture.love -- a blank-slate mode for the
|
||||
note-taking app, so all the stuff pensieve.love puts on screen doesn't cause
|
||||
you to forget what you came to write down.
|
||||
Further forks are encouraged. If you show me your fork, I'll link to it here.
|
||||
|
||||
## Associated tools
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@ function Drawing.draw(State, line_index, y)
|
|||
end
|
||||
App.color(Current_stroke_color)
|
||||
Drawing.draw_pending_shape(line, line_cache.starty, State.left,State.right)
|
||||
line.top = line_cache.starty+Drawing.pixels(line.h, State.width)
|
||||
end
|
||||
|
||||
function Drawing.draw_shape(drawing, shape, top, left,right)
|
||||
|
|
7
edit.lua
7
edit.lua
|
@ -164,6 +164,13 @@ function edit.draw(State)
|
|||
y = y+Drawing_padding_top
|
||||
Drawing.draw(State, line_index, y)
|
||||
y = y + Drawing.pixels(line.h, State.width) + Drawing_padding_bottom
|
||||
if line.lines then
|
||||
for dindex, dline in ipairs(line.lines) do
|
||||
if y + Editor_state.line_height > App.screen.height then break end
|
||||
y, _ = Text.draw(line, dindex, y, 1) -- TODO: scrolling
|
||||
y = y + State.line_height
|
||||
end
|
||||
end
|
||||
else
|
||||
print(line.mode)
|
||||
assert(false)
|
||||
|
|
17
file.lua
17
file.lua
|
@ -52,10 +52,12 @@ function save_to_disk(State)
|
|||
end
|
||||
|
||||
function load_drawing(infile_next_line)
|
||||
local drawing = {mode='drawing', h=256/2, points={}, shapes={}, pending={}}
|
||||
local drawing = {mode='drawing', h=256/2, points={}, shapes={}, pending={}, lines={}}
|
||||
table.insert(drawing.lines, {mode='text', data='```lines'})
|
||||
while true do
|
||||
local line = infile_next_line()
|
||||
assert(line)
|
||||
table.insert(drawing.lines, {mode='text', data=line})
|
||||
if line == '```' then break end
|
||||
local shape = json.decode(line)
|
||||
if shape.mode == 'freehand' then
|
||||
|
@ -85,6 +87,19 @@ function load_drawing(infile_next_line)
|
|||
end
|
||||
table.insert(drawing.shapes, shape)
|
||||
end
|
||||
-- hackily include some stuff from edit.initialize_state
|
||||
Text.redraw_all(drawing)
|
||||
drawing.screen_top1 = {line=1, pos=1}
|
||||
drawing.cursor1 = {line=1, pos=1}
|
||||
drawing.screen_bottom1 = {line=1, pos=1}
|
||||
drawing.selection1 = {line=1, pos=1}
|
||||
drawing.recent_mouse = {line=1, pos=1}
|
||||
drawing.font_height = Editor_state.font_height
|
||||
drawing.line_height = Editor_state.line_height
|
||||
drawing.em = Editor_state.em
|
||||
drawing.left = Editor_state.left
|
||||
drawing.right = Editor_state.right
|
||||
drawing.width = Editor_state.width
|
||||
return drawing
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue