Skip to content

v2: one-gesture auto-move (shift everything below automatically) #23

Description

@gorlix

Context

v1 hands off to the native lasso so the user drags manually. The OneNote-style target is a single gesture: drag down and everything below the line shifts automatically by the drag delta — no manual lasso drag.

Why this is hard (the core of v2)

The SDK has no "move selection" API (resizeLassoRect = proportional scale only). Auto-move must rewrite each element's position by hand:

  • Stroke: shift every sample point (stroke.points via ElementDataAccessor.setRange) + maxY, in EMR coords (convert pixel delta with PointUtils.androidPoint2Emr).
  • Geometry / TextBox / Picture / Title / FiveStar: shift pixel fields (points, textRect, rect, Y, etc.). Title also moves its controlTrailNums strokes.
    Then modifyElements + PluginNoteAPI.saveCurrentNote + PluginCommAPI.reloadFile.

Goal

Drag on the overlay → compute cutY + delta → shift every element with y > cutY by delta → persist. Bidirectional (down = add space, up = remove space).

Approach (incremental)

  1. Read elements: PluginFileAPI.getElements(page, path).
  2. Filter elements below cutY.
  3. Per type, shift position fields (pixel) and, for strokes, EMR points via setRange + maxY.
  4. modifyElements(path, page, changed)saveCurrentNote()reloadFile().
  5. Heavy performance test on a dense page (many stroke points = many native round-trips).

Acceptance criteria

  • Single drag moves all element types below the line by the delta.
  • Strokes move correctly (EMR conversion verified on-device).
  • Undo works (or an explicit confirm/undo is provided).
  • Acceptable performance on a full handwriting page.

References

  • references/make-space.md §10 (out of scope of v1)
  • references/types.md, references/api-quick-ref.md (element fields, modifyElements)
  • SKILL.md "Coordinate Systems", "Element & ElementDataAccessor"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv2Belongs to v2 (advanced auto-move)

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions