Skip to content

Live preview of the real link while drawing + default link style = elbow arrow #4

Description

@rustamgarifulin

Why

While drawing/dragging a link, the overlay shows a straight dashed line (drawLinkPreview) instead of the link as it will actually render (routing, arrowheads, style). Also: default new link should be an elbow arrow instead of a straight line.

Proposed solution

Default style of a new link → elbow arrow:

  • New links created with routing: "orthogonal" (Manhattan elbow) + end arrowhead (arrowheads.end = "arrow"/"triangle"). Was: default routing straight, no arrowheads (packages/scene/src/edge.ts:114-139).
  • Decide WHERE default is set (computeCreateLink in scene vs state at creation) without breaking serialization of old links (fields optional — old links without routing stay straight, or migrate).
  • Constants (arrowhead on/off, length, type) in constants.ts.

Live preview = the real rendered link:

  • During draw-edge / endpoint-drag, show link with real rendering (routing + arrowhead + dash/color/lineKind) instead of straight drawLinkPreview.
  • Source of truth = same path that draws committed link (renderLinks / edge-renderer in renderer-core). Build a ghost Link from preview endpoints through the same render path, or render a temporary link in the main layer.
  • Handle preview endpoints not yet bound (point) or bound to anchor/outline — route correctly for all three.
  • Both backends (Canvas2D + WebGL2); manual verification + snapshot if applicable.

Where in code: packages/scene/src/edge.ts / operations.ts (computeCreateLink) — default routing/arrowhead; packages/state/src/overlay.ts (drawLinkPreview, edgePreview) — replace line with real rendering; packages/state/src/editor.ts (applyLinkPreview, computeLinkPreviewEndpoints, applyCreateLink); packages/renderer-core edge-renderer — reuse for preview; constants.ts — arrowhead/elbow defaults.

Kind: feature

Alternatives / Notes

  • UI/UX change → needs approval of details (arrowhead type, thickness, color, elbow behavior across relative positions) before implementing. Do AFTER anchor-overlay-ux bugs are closed.
  • Status (2026-06-18): Section 1 (default = elbow) DONE (DEFAULT_LINK_ROUTING = "orthogonal" in buildLinkForCreate). Section 2 (applyLinkPreview / routeElbowPreview in editor.ts, render-orchestrator.ts) appears implemented; needs manual verification (both backends, all three endpoint types) before closing.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions