Skip to content

fix(render): schematic 2D draw-path correctness — field TextProp ignored, plus static-review findings pending verification #171

Description

@hkngln

2D draw-path survey findings, deduplicated against #100/#102/#114. One finding is fully verified; the rest come from the same static review but their independent verification pass was cut short — each must be re-verified against the code before fixing (line refs are from trunk b3c9afa).

Verified

  1. Reference/value field TextProp is ignored by the renderer while hit-test and drag use the real stored position. build_renderer_snapshot draws the reference at (symbol.position.x, symbol.position.y - 3.5) and value at +3.6, size hardcoded 1.05mm, alignment hardcoded, rotation = symbol rotation (schematic_runtime.rs:419-444) — sym.ref_text / sym.val_text (position, rotation, font_size, justify) are never read. Meanwhile hit-testing places the field boxes at instance_transform(prop.position) with prop.font_size (schematic_runtime.rs:1480-1486) and field drag mutates rt.position/vt.position (canvas/mod.rs:1952-1971). Consequence: dragging a ref/val field moves its hit-box but the drawn text stays put — the file's stored text properties (including anything an imported/edited document carries) have no visual effect. Fix: render from the TextProp (position/rotation/size/justify), falling back to today's offsets only when unset; keep hit-test and draw reading the same source.

Pending verification (static review; verify each before fixing)

  1. Three-point arc drawings render vertically mirrored — producer computes angles in y-down world, consumer negates assuming y-up (renderer_scene_canvas.rs).
  2. Global/Hierarchical label flag shape diverges from docs/RENDERING_RULES.md (tip direction at 0°; centered text rendering half outside the flag) (schematic_runtime.rs).
  3. Labels/text notes are culled by anchor point with a fixed ~22/28px pad — long text pops in/out near viewport edges (schematic_runtime.rs).
  4. render_config style/font settings are write-only on some paths (PowerPortStyle/LabelStyle/MultisheetStyle + canvas font settings) — preference changes may not take effect until an unrelated invalidation (render_config.rs).
  5. Schematic content layer fully rebuilds (snapshot → scene → tessellation → text layout) on every pan/zoom frame (canvas/mod.rs); PCB canvas confirmed doing the same full re-tessellation per pan/zoom frame and reusing schematic-tuned settings (pcb_canvas.rs) — overlaps the perf narrative of [High] Performance: per-frame disk I/O, re-parse, re-sort and re-tessellate on the UI thread #111 but these are the draw-path specifics.
  6. Drag-to-move deep-clones the entire SchematicSheet (incl. lib_symbols) every draw frame (canvas/mod.rs).
  7. SchematicRenderCache invalidation is all-or-nothing; RenderInvalidation bitflags are dead plumbing (schematic_runtime.rs).
  8. Reported claim, treat with extra caution: a draw path renders symbols as fixed placeholder boxes, dropping lib-symbol geometry/pins (schematic_runtime.rs) — if real, this is likely a fallback/secondary path, not the main renderer; verify precisely which path before acting.
  9. Low: ghost/selection/ERC overlay passes resolve a hardcoded default theme per call instead of the active canvas colors (schematic_runtime.rs).

Suggested slicing

Item 1 is a standalone bugfix PR. Items 2–5 are individually small once verified. Items 6–8 belong together as a draw-path performance PR (dirty-region/tessellation caching) and should coordinate with #166 (canvas decomposition) to avoid churn.

Acceptance criteria

  • Item 1: field drag moves the drawn text and its hit-box together; documents with stored text properties render them; regression test drives the drag path.
  • Each pending item gets a verify-then-fix note in its PR (confirmed with file:line, or closed as not-reproducible).

Metadata

Metadata

Assignees

No one assigned

    Labels

    renderingCanvas rendering, hit-testingschematicSchematic editortier: p0Required for v1.0 — Community Preview cannot ship without ittype: bugSomething works incorrectly

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions