Skip to content

vellum 0.6.6

Choose a tag to compare

@schochastics schochastics released this 01 Aug 20:04
· 12 commits to main since this release
f3c2552
  • Fix: element_geometry() and vl_nearest() reported viewport-local
    coordinates, not device pixels.
    The pick table resolved every vertex through
    vp.x_pos()/y_pos() — which answer in the viewport's own frame — and never
    applied the viewport's transform. So for any viewport not at the page origin,
    which is every panel of every real plot:

    • element_geometry() was off by the viewport's offset, and internally
      inconsistent
      : text and roundrect rows went through node_bbox() and
      came back in device px, while segment / line / polygon / path /
      point / rect rows stayed local. One table, two coordinate systems.
    • vl_nearest() compared a device-px probe point against those local
      coordinates, so its answers in an offset panel were not merely imprecise but
      wrong — it would report a mark at distance 0 with the cursor nowhere near it,
      and rank the mark actually under the cursor far down the list.

    Both now report device pixels with y down, matching scene_model()'s boxes and
    the rendered SVG, as documented. A round mark's radius takes the transform's
    scale as well as its translation.

    This is the same bug lint_table() had before 0.6.1, and it survived for the
    same reason: every test in test-pick.R drew into the default full-page
    viewport, where the transform is the identity and local is device. The
    regression tests added here use an off-origin viewport.

    Nothing rendered changes — the pick table feeds no drawing path.

  • Docs fix: the leader-line example placed labels and drew leaders from two
    different solves.
    vignette("placement") and inst/examples/labels.R both
    computed vl_place(scene), drew leaders from that answer, and then called
    vl_repel() on the scene with the leaders already in it. The leaders are
    obstacles to that second solve — and since each one lies exactly along the path
    its label wanted to take, and vl_place() works on bounding boxes (so a
    diagonal segment blocks the whole rectangle spanning it), the labels were
    pushed back the way they came. The median leader ended up 146° from the
    label's real displacement, with half of them pointing essentially backwards.

    Both now place first and annotate afterwards, which makes the leaders exact,
    and both say why. No engine change — vl_repel() was applying the solve it
    reported all along. The general rule, now stated in the article: anything you
    add to a scene becomes an obstacle to a later solve.