Skip to content

feat(renderer): raster image LOD / progressive resolution loading for zoom-in fidelity #38

@LeslieOA

Description

@LeslieOA

Summary

From the zoom-rendering audit (Workspace CC).

PNG/JPEG file nodes render at their native resolution then get scaled by the camera matrix. Zoom in past ~2× and you see bilinear blur. No mipmap pyramid, no progressive resolution loading.

Proposed fix shape

The renderer maintains a downsampled cache (for zoom-out crispness) and requests higher-resolution variants from disk when:

  • The source file has them (e.g. image@2x.png, image@3x.png)
  • OR the camera scale exceeds a threshold where the current resolution becomes visibly blurry

Approach:

  1. Downsampling cache — at parse / first-render time, generate a small thumbnail for zoom-out display
  2. Resolution selection — at render time, pick the cache entry whose native dimensions × scale ≈ the current display size in device pixels
  3. Progressive loading — when the camera zooms in past a threshold, kick off an async fetch of the original (or @2x / @3x variant) and swap in when ready

Acceptance criteria

  • Image cache infrastructure in place (probably useImageCache.ts hook + lifecycle)
  • At native scale, images render identically to today
  • At zoom-out (< 0.5× scale), images use a downsampled cache entry — no bilinear blur from over-large source
  • At zoom-in (> 2× scale), higher-resolution variants are loaded if available (file naming convention or @Nx discovery)
  • Cache evicted on document close or memory-pressure signals
  • Test fixture: a canvas with a large PNG, verify no resolution change when zooming and that no source re-decode happens within the bilinear-friendly range

Notes

The CC report flagged this as "out of scope for the Rust port's MVP but worth a backlog ticket on that project". This is a TS-renderer item that doesn't block the Rust port — the image pipeline is renderer-layer concern.

Sizing: L. Cache infrastructure, async loading, eviction policy, image-naming conventions are each their own design call.

Refs

Surfaced during the zoom-rendering improvements audit (Workspace CC).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions