Skip to content

feat: add trackpad control button and improve mouse movement handling#48

Merged
Chow411 merged 1 commit into
mainfrom
feature/improve-mouse-move-ux
Jul 3, 2026
Merged

feat: add trackpad control button and improve mouse movement handling#48
Chow411 merged 1 commit into
mainfrom
feature/improve-mouse-move-ux

Conversation

@Chow411

@Chow411 Chow411 commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings July 3, 2026 06: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.

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 CustomTouchListener mouse 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");
}
@Chow411 Chow411 merged commit dd8d214 into main Jul 3, 2026
3 checks passed
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