append_layer: write strokes onto a tablet page in our own layer #72
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/51-append-layer"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Refs #51. Spike for in-page write-back (docs/todo-sync.md, Write-back; D20, D22, D23). Writer only: nothing calls it yet, and nothing writes to the cloud.
What it adds
Lines.Writer.append_layer(original_rm, strokes, author_uuid): adds strokes to a page the tablet wrote, in a layer of our own, "rM-Analyzer".{:ok, rm, %{layer: id, stroke_ids: [...]}}. A page that isn't v6, is cut off, or has no author block gets an error sentence.Lines.parsekeeps each stroke's item id (Stroke.id,{author, counter}). The layer's author is its id's first element. That's what D22 needs to find our strokes again.Checked
Golden test on both fixtures: every block but 0x09 is identical, then exactly tree, node, group item and the lines.
Lines.parsereturns the original layers unchanged, with ours on top. A second write reuses the author and layer, and its ids are higher.rmscene 0.6.1
read_treereads both written pages: the original layers as they were plus "rM-Analyzer" with 3 strokes, and 2 authors.mix precommit: 1128 tests, 0 failures (ae62732).PageInk.planreplaces only<doc>/<page>.rmand keeps every other file as the cloud has it;Commit.planmust add nothing.PageInk.write(account, ink, expected_hash): writes only while the page is still the version we read (else{:skipped, :page_changed}) and the notebook has been quiet 10 min (else{:skipped, :tablet_busy}). On a 412 it syncs and plans again from the new bytes, up to 3 times. The old page stays in the blob store, and the page's current text is carried to the new hash (W1). Logs page, old/new hash, generation, attempt, duration.OCR leaves out our layer (D22):
Scenereads the author ids, andScene.without_author/2drops layers whose node id has the device's number. Only numbers 2 and up count. A page the app drew whole lists the app as 1, and a layer the user adds there has to stay readable.TranscribeWorkeruses it both for the handwriting check and for the image (PageImage.png(..., without_author:), rendered fresh only when the page has our layer). Tests: the image matches the page without our layer, and a page with only our marks isn't sent to OCR (C30).Not yet: the tablet test 2a–2c (D23), which is the go/no-go. (The geometric tick,
Lines.Marks, landed in 5badeb7/803f4c2.)d80680d: row-geometry task finder (D31/D32).Lines.Rows.find(scene, author, layout)returns all 36 rows of a todo page: row k is the band (rule k-1, rule k], a stroke belongs to the row holding its bbox's vertical centre, and it's writing only when its horizontal centre is right of the margin. Each row has the user's stroke ids (his), ours by author number in any layer (ours), andtickedfromMarks.ticked/3in the row's printed box.tasks/1= rows with his writing (a tick in an empty row's box is ignored; ordinal = row index),next_free/1= first empty row below the lowest written one, or:full, andoutside/3counts his writing below the last rule so the caller can hold the page. The layout (rules, margin,boxes) is the template's 1404×1872 geometry, passed in so this branch doesn't depend on #71; the sync passesTodos.Template.boxes/0once both are in. Scene coordinates (x centred, the page's own size) are mapped onto it the way the template'ssx/syscale on the tablet. 8 tests, incl. our strokes vs his in our layer and a Paper Pro-sized page. Risk: the Paper Pro mapping is reasoned fromsx/sy, not seen on a tablet.outside/3 counts only strokes above the page; a tick in a printed box is in the margin, not outside (F7). A stroke whose centre is in the top third of a band, just under rule k, while row k has writing, joins row k: a separate g/y tail or an underline, not a phantom task in row k+1 (F8). The tick glyph strip takes an optional U+FE0F after the glyph and knows ✅, ✗, ✘ (F9).A stroke centred above row 0's band (y < rule_y - line_height, per repeat) is the title: no task, not outside. title/3 gives his strokes in the first page's band; texts/3 drops OCR's first line when there are any and returns it as the title ({:ok, pairs, title | nil}). A repeat's band writing has no line dropped, so it holds the page.WIP: append_layer: write strokes onto a tablet page in our own layerto append_layer: write strokes onto a tablet page in our own layer