Skip to content

Draw a uniform filled shape on a single tap - #591

Merged
burhanrashid52 merged 1 commit into
burhanrashid52:masterfrom
stephanepechard:feature/tap-to-draw-filled-circle
Jun 9, 2026
Merged

Draw a uniform filled shape on a single tap#591
burhanrashid52 merged 1 commit into
burhanrashid52:masterfrom
stephanepechard:feature/tap-to-draw-filled-circle

Conversation

@stephanepechard

@stephanepechard stephanepechard commented May 27, 2026

Copy link
Copy Markdown
Contributor

Problem

A single tap on the drawing view (a touch that ends without dragging) produced nothing for most shapes: endShape() detected the empty/half-formed shape via hasBeenTapped() and removed it, with the handleTap(...) call left commented out.

Change

  • Detect a tap at the view level: a touch whose movement never exceeds TAP_TOLERANCE is treated as a tap rather than a drag (more reliable than the per-shape hasBeenTapped() bounds check, which never fired for BrushShape).
  • On a tap, draw a uniform filled version of the selected shape, sized from the current shape thickness: a circle for an oval, a square for a rectangle.
  • Shapes with no meaningful single-point form (line, arrow, freehand brush) and taps while erasing draw nothing.
  • OvalShape.drawCircle(...) / RectangleShape.drawSquare(...) build the centered shape path.

Tests

Adds instrumented tests in DrawingViewTouchEventTest:

  • testTapWithOvalDrawsUniformFilledCircle
  • testTapWithRectangleDrawsUniformFilledSquare
  • testTapWithPointlessShapeDrawsNothing (line/brush/arrow)
  • testTapWhileErasingDrawsNothing

Tapping the drawing view (a touch with no drag) left a half-formed shape that
endShape() discarded, so a single tap drew nothing. Detect a tap at the view
level (a touch that never moves beyond TAP_TOLERANCE) and replace it with a
uniform filled version of the selected shape, sized from the shape thickness:
a circle for an oval, a square for a rectangle. Shapes with no single-point
form (line, arrow, freehand) and taps while erasing draw nothing. Adds
instrumented tests covering each case.
@stephanepechard
stephanepechard force-pushed the feature/tap-to-draw-filled-circle branch from fd74254 to 5203ec1 Compare May 27, 2026 10:29
@stephanepechard stephanepechard changed the title Draw a uniform filled circle on a single tap Draw a uniform filled shape on a single tap May 27, 2026
@burhanrashid52
burhanrashid52 requested a review from Copilot May 31, 2026 07:29

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.

Pull request overview

This PR makes single taps on DrawingView produce a visible result for supported shapes by detecting taps at the view level (movement within a small tolerance) and, on tap, drawing a uniform filled circle/square sized from the current shape thickness. It also adds instrumented tests covering the new tap behavior.

Changes:

  • Add view-level tap detection (tap vs drag) and route taps to a new handleTap(...) implementation.
  • On tap, draw a filled uniform circle (Oval) or square (Rectangle); do nothing for line/arrow/brush and while erasing.
  • Add instrumented tests for tap behavior for oval/rectangle, pointless shapes, and erasing.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

File Description
photoeditor/src/main/java/ja/burhanrashid52/photoeditor/shape/RectangleShape.kt Adds drawSquare(...) helper for tap-created square paths.
photoeditor/src/main/java/ja/burhanrashid52/photoeditor/shape/OvalShape.kt Adds drawCircle(...) helper for tap-created circle paths.
photoeditor/src/main/java/ja/burhanrashid52/photoeditor/DrawingView.kt Implements tap detection and tap-to-filled-shape behavior.
photoeditor/src/androidTest/java/ja/burhanrashid52/photoeditor/DrawingViewTouchEventTest.kt Adds new instrumented tests validating tap outcomes.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@burhanrashid52

Copy link
Copy Markdown
Owner

@stephanepechard Have a look at this PR agent review. And feel free to close the conversation if its not relevant. Please merge it and release it once that is done.

@stephanepechard

Copy link
Copy Markdown
Contributor Author

@burhanrashid52 I cannot merge, I need an approving review. AI comments have been resolved.

@burhanrashid52
burhanrashid52 self-requested a review June 9, 2026 06:23
@burhanrashid52
burhanrashid52 merged commit 8f57194 into burhanrashid52:master Jun 9, 2026
3 checks passed
@stephanepechard
stephanepechard deleted the feature/tap-to-draw-filled-circle branch June 26, 2026 06:33
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.

3 participants