forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on 7122d71744bea23bd00bcfe91b997c19fba1e4d6Filtered to src/api/exams/getStudentAnswerImage.tsClear filter

2026-07-22

feat: 🎬 replay a student's answer drawing stroke-by-strokeAhmet Kaan Gümüş · 595aa7e
feat: 🎬 replay a student's answer drawing stroke-by-stroke

- teachers can play back a drawn exam answer in the grading answer
  sheet, watching how the student built it instead of only seeing the
  finished image
- no backend change: the drawing PNG already carries its editable stroke
  JSON in a tEXt chunk, so pngBytesToScene recovers the strokes
  client-side from the grader image that was already being served
- add a getStudentAnswerImage wrapper for
  GET /exams/{examId}/attempts/{userId}/answers/{questionId}/image;
  the route had no wrapper before, only a raw <img src>
- DrawingPlayback runs a requestAnimationFrame loop revealing points in
  drawn order at a constant POINTS_PER_SECOND, with play/pause/restart;
  pacing is order-only because the capture stores no timestamps
- pure sliceStrokes(strokes, revealCount) -> { full, partial } lives
  beside strokesBounds and is unit-tested
- the static image stays the default view; playback is a reversible
  toggle and falls back to the plain image when a PNG has no embedded
  strokes
- eraser strokes replay through a two-layer composite (ink on a
  transparent layer, then over white + paper) mirroring
  canvasToImageBlob, so a fully-revealed frame matches the saved PNG
- EN/TR i18n keys for the playback controls