Skip to content

feat(whiteboard): erase on stylus press#19875

Closed
BrayanDSO wants to merge 1 commit intoankidroid:mainfrom
BrayanDSO:feat/stylus
Closed

feat(whiteboard): erase on stylus press#19875
BrayanDSO wants to merge 1 commit intoankidroid:mainfrom
BrayanDSO:feat/stylus

Conversation

@BrayanDSO
Copy link
Member

Purpose / Description

Adds the old whiteboard behavior of erasing while the stylus button is pressed

Approach

  1. Combine the eraser properties into an eraserTool flow
  2. combine the tool properties into a WhiteboardTool class and flow
  3. add an isStylusButtonPressed flow
  4. setup the view to listen for stylus button presses
  5. do some minor cleanups

How Has This Been Tested?

Galaxy Tab S9, Android 16, with an S-Pen

Screen_Recording_20251220_161455_AnkiDroid.mp4

Checklist

Please, go through these checks before submitting the PR.

  • You have a descriptive commit message with a short title (first line, max 50 chars).
  • You have commented your code, particularly in hard-to-understand areas
  • You have performed a self-review of your own code
  • UI changes: include screenshots of all affected screens (in particular showing any new or changed strings)
  • UI Changes: You have tested your change using the Google Accessibility Scanner

1. Combine the eraser properties into an eraserTool flow
2. combine the tool properties into a WhiteboardTool class and flow
3. add a isStylusButtonPressed flow
4. setup the view to listen for stylus button presses
Copy link
Member

@david-allison david-allison left a comment

Choose a reason for hiding this comment

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

Thanks! Both are nits

Comment on lines +137 to +141
isEraserActive,
activeBrushIndex,
brushes,
isStylusButtonPressed,
eraserTool,
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is complex - see if you can convert this into:

  • brush config
  • eraser config
  • selected tool (isEraserActive)

) {
if (paths.value.isEmpty()) return
val currentTool = effectiveTool.value
if (currentTool !is WhiteboardTool.Eraser || currentTool.mode != EraserMode.STROKE) return
Copy link
Member

Choose a reason for hiding this comment

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

A comment guiding someone to the stroke implementation would be useful

Comment on lines +128 to +132
val toolType = event.getToolType(0)
val isButtonPressed =
(event.buttonState and MotionEvent.BUTTON_STYLUS_PRIMARY != 0) ||
(toolType == MotionEvent.TOOL_TYPE_ERASER)
onStylusButtonStateChanged?.invoke(isButtonPressed)
Copy link
Member

Choose a reason for hiding this comment

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

nit: this is fairly involved, lightly consider an extension/method

@david-allison david-allison added Needs Second Approval Has one approval, one more approval to merge and removed Needs Review labels Dec 22, 2025
@BrayanDSO BrayanDSO added the Needs Author Reply Waiting for a reply from the original author label Dec 22, 2025
@BrayanDSO BrayanDSO marked this pull request as draft December 29, 2025 20:28
@github-actions
Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Jan 21, 2026
@BrayanDSO
Copy link
Member Author

Forgot about this, dear bot. I'll eventually come back to the whiteboard work, trust me.

@github-actions
Copy link
Contributor

github-actions bot commented Feb 4, 2026

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Feb 4, 2026
@BrayanDSO BrayanDSO removed the Stale label Feb 4, 2026
@david-allison
Copy link
Member

@BrayanDSO, we still getting this in?

@BrayanDSO
Copy link
Member Author

yes

@github-actions
Copy link
Contributor

Hello 👋, this PR has had no activity for more than 2 weeks and needs a reply from the author. If you think this is a mistake please comment and ping a maintainer to get this merged ASAP! Thanks for contributing! You have 7 days until this gets closed automatically

@github-actions github-actions bot added the Stale label Feb 19, 2026
@BrayanDSO BrayanDSO removed the Stale label Feb 20, 2026
@david-allison david-allison added the Keep Open avoids the stale bot label Mar 4, 2026
@BrayanDSO BrayanDSO closed this Mar 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Has Conflicts Keep Open avoids the stale bot Needs Author Reply Waiting for a reply from the original author Needs Second Approval Has one approval, one more approval to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants