Skip to content

Allow annotations to start outside the canvas - #108

Open
jondkinney wants to merge 4 commits into
omacom:mainfrom
jondkinney:feat/off-canvas-annotations
Open

Allow annotations to start outside the canvas#108
jondkinney wants to merge 4 commits into
omacom:mainfrom
jondkinney:feat/off-canvas-annotations

Conversation

@jondkinney

Copy link
Copy Markdown
Collaborator

Summary

  • treat unused fullscreen edit space as an annotation workspace for arrows, lines, strokes, shapes, markers, spotlights, and text
  • grow the canvas from committed annotation bounds while keeping redact, cut, OCR, and eyedropper limited to source pixels
  • preserve strict Image boundary behavior, off-canvas previews, and ordinary operation-log undo/redo

Test plan

  • make check
  • smoke coverage for arrow-to-canvas callouts, labels at the outer endpoint, marker preview/placement, source-tool rejection, undo contraction, and Image mode

Copilot AI balanced review requested due to automatic review settings September 5, 2026 16:46
@jondkinney
jondkinney force-pushed the feat/off-canvas-annotations branch from ad1f316 to 58227d6 Compare September 5, 2026 16:46

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Chrome hit-testing and incremental marker preview repainting have unresolved correctness issues.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Enables annotations to begin in the workspace surrounding a screenshot and expand the canvas.

Changes:

  • Adds off-canvas creation rules and previews while restricting source-based tools.
  • Adds smoke coverage for creation, undo, and boundary behavior.
  • Documents the expanded workspace behavior.
File summaries
File Description
src/editor.cpp Implements off-canvas creation and rendering.
src/editor.hpp Declares workspace hit-testing helpers.
tests/editor-smoke.cpp Tests off-canvas workflows and restrictions.
README.md Documents canvas growth behavior.
Review details

Suppressed comments (1)

src/editor.cpp:6297

  • The marker ghost can now be painted outside editImageRect(), but pointerMotionRegion() still adds the marker’s actual bounds only when editImageRect().contains(point) (line 4162). Mouse movement uses partial repaint regions, so a large or zoomed marker in the new workspace can be clipped or leave stale pixels; this smoke test’s grab() forces a full repaint and masks the problem. Use the same canStartAnnotationAt(point) predicate in marker damage calculation.
  const bool markerPreview = tool_ == Tool::Marker && !dragging_ &&
                             canStartAnnotationAt(cursor_) &&
                             !pointerGrabsLayer();
  const bool markerPreviewOutsideCanvas =
      markerPreview && !image.contains(cursor_);
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/editor.cpp
Comment on lines +1879 to +1896
bool CaptureEditor::canStartAnnotationAt(const QPointF &position) const {
if (requiresSourcePixels(tool_))
return sourceFrameWidgetRect().contains(position);
if (editImageRect().contains(position))
return true;
if (canvasBoundaryMode_ == CanvasBoundaryMode::Image ||
!supportsOffCanvasCreation(tool_) ||
!annotationWorkspaceRect().contains(position))
return false;
// Popovers overlap the content band. Their buttons are handled before the
// workspace, while their padding must remain chrome rather than canvas.
if ((colorPaletteOpen_ && colorPaletteRect().contains(position)) ||
(customColorPickerOpen_ && customColorPanelRect().contains(position)) ||
(shapeMenuOpen_ && shapeMenuRect().contains(position)) ||
(textSizeMenuOpen_ && textSizePanelRect().contains(position)))
return false;
return true;
}
Copilot AI review requested due to automatic review settings September 6, 2026 23:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

An in-flight highlighter probe can incorrectly affect an off-canvas stroke.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/editor.cpp Outdated
Comment on lines 5465 to 5469
} else if (canStartAnnotationAt(cursor_)) {
scheduleHighlighterProbe(toUnclampedAnnotationPoint(cursor_));
} else {
clearHighlighterPreview();
}
Copilot AI review requested due to automatic review settings September 7, 2026 00:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Right-side off-canvas text is constrained to a 48-pixel editor and becomes clipped while typing.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 1
  • Review effort level: Balanced

Comment thread src/editor.cpp
case CaptureEditor::Tool::Marker:
case CaptureEditor::Tool::Rectangle:
case CaptureEditor::Tool::Ellipse:
case CaptureEditor::Tool::Text:
Copilot AI review requested due to automatic review settings September 7, 2026 00:48

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The implementation is consistent with existing canvas behavior and includes focused regression coverage.

Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0 new
  • Review effort level: Balanced

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants