feat: add trackpad control button and improve mouse movement handling#48
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a “Trackpad Mode” UI control and refactors mouse/touch handling so cursor positioning and relative movement become zoom/pan-aware (notably in portrait zoom), plus adds documentation describing the zoom/cursor architecture and viewport-center-follow behavior.
Changes:
- Add a new Trackpad Mode button and string resource, with corresponding mode toggling in the drawer UI.
- Improve
CustomTouchListenermouse handling: zoom-aware coordinate mapping, virtual trackpad mode, and viewport-center cursor following after panning. - Add mouse/zoom architecture and viewport-follow documentation.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/mouse/zoom-and-cursor-architecture.md | New architecture doc for zoom/pan, coordinate transforms, and HID pipeline. |
| docs/mouse/viewport-center-following.md | New doc explaining viewport-center cursor follow and integration points. |
| docs/mouse/README.md | Index/overview for the new mouse documentation set. |
| app/src/main/res/values/strings.xml | Adds Trackpad Mode label string. |
| app/src/main/res/layout/drawer_layout_setup.xml | Adds Trackpad Mode button to the control strip layout. |
| app/src/main/res/drawable/baseline_touch_app_24.xml | Adds a vector drawable icon for the Trackpad Mode button. |
| app/src/main/java/com/openterface/AOS/serial/CustomTouchListener.java | Implements virtual trackpad mode, delayed initial abs send, viewport-center following, and zoom-aware movement mapping. |
| app/src/main/java/com/openterface/AOS/drawerLayout/ZoomLayoutDeal.java | Delegates PiP-drag cursor repositioning to moveMouseToViewportCenter(). |
| app/src/main/java/com/openterface/AOS/drawerLayout/DrawerLayoutDeal.java | Wires up the new Trackpad Mode button and toggles virtualTrackpadMode. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+649
to
+653
| // Clamp to valid content range | ||
| contentX = Math.max(0, Math.min(contentX, viewWidth)); | ||
| contentY = Math.max(0, Math.min(contentY, viewHeight)); | ||
|
|
||
| return new float[]{contentX, contentY}; |
Comment on lines
+529
to
+539
| // Content coords are in range [0, viewWidth] x [0, viewHeight] | ||
| // HidManager.sendHexAbsData expects HID reference coordinates | ||
| // Scale proportionally to convert | ||
| int hidWidth = HidManager.getScreenWidth(); | ||
| int hidHeight = HidManager.getScreenHeight(); | ||
| float hidX = content[0] / viewWidth * hidWidth; | ||
| float hidY = content[1] / viewHeight * hidHeight; | ||
|
|
||
| HidManager.sendHexAbsData(hidX, hidY); | ||
| Log.d(TAG, "moveMouseToViewportCenter: content=(" + content[0] + "," + content[1] | ||
| + ") hid=(" + hidX + "," + hidY + ")"); |
Comment on lines
484
to
488
| private static void setMouseLocation(int setMaxViewX, int setMaxViewY) { | ||
| float mouseLocationX = (float)setMaxViewX + screenWidth/2.0f; | ||
| float mouseLocationY = (float)setMaxViewY + screenHeight/2.0f; | ||
| HidManager.sendHexAbsData(mouseLocationX, mouseLocationY); | ||
| Log.d(TAG, "mouseLocationX: " + mouseLocationX + " mouseLocationY: " + mouseLocationY); | ||
| // Delegate to CustomTouchListener to calculate viewport center based on current zoom/pan state | ||
| com.openterface.AOS.serial.CustomTouchListener.moveMouseToViewportCenter(); | ||
| Log.d(TAG, "setMouseLocation: moved to viewport center"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.