feat(whiteboard): erase on stylus press#19875
feat(whiteboard): erase on stylus press#19875BrayanDSO wants to merge 1 commit intoankidroid:mainfrom
Conversation
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
| isEraserActive, | ||
| activeBrushIndex, | ||
| brushes, | ||
| isStylusButtonPressed, | ||
| eraserTool, |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
A comment guiding someone to the stroke implementation would be useful
| val toolType = event.getToolType(0) | ||
| val isButtonPressed = | ||
| (event.buttonState and MotionEvent.BUTTON_STYLUS_PRIMARY != 0) || | ||
| (toolType == MotionEvent.TOOL_TYPE_ERASER) | ||
| onStylusButtonStateChanged?.invoke(isButtonPressed) |
There was a problem hiding this comment.
nit: this is fairly involved, lightly consider an extension/method
|
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 |
|
Forgot about this, dear bot. I'll eventually come back to the whiteboard work, trust me. |
|
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 |
|
@BrayanDSO, we still getting this in? |
|
yes |
|
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 |
Purpose / Description
Adds the old whiteboard behavior of erasing while the stylus button is pressed
Approach
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.