mirror of
https://github.com/Genymobile/scrcpy
synced 2024-12-22 07:10:34 +00:00
Add shortcut for horizontal tilt
Use Ctrl+Shift for horizontal tilt. Refs #4529 comment <https://github.com/Genymobile/scrcpy/pull/4529#issuecomment-1855397118> Fixes #5317 <https://github.com/Genymobile/scrcpy/issues/5317>
This commit is contained in:
parent
d92b7a6024
commit
7a9ea5c66f
@ -727,7 +727,11 @@ Pinch-to-zoom and rotate from the center of the screen
|
||||
|
||||
.TP
|
||||
.B Shift+click-and-move
|
||||
Tilt (slide vertically with two fingers)
|
||||
Tilt vertically (slide with 2 fingers)
|
||||
|
||||
.TP
|
||||
.B Ctrl+Shift+click-and-move
|
||||
Tilt horizontally (slide with 2 fingers)
|
||||
|
||||
.TP
|
||||
.B Drag & drop APK file
|
||||
|
@ -1072,7 +1072,11 @@ static const struct sc_shortcut shortcuts[] = {
|
||||
},
|
||||
{
|
||||
.shortcuts = { "Shift+click-and-move" },
|
||||
.text = "Tilt (slide vertically with two fingers)",
|
||||
.text = "Tilt vertically (slide with 2 fingers)",
|
||||
},
|
||||
{
|
||||
.shortcuts = { "Ctrl+Shift+click-and-move" },
|
||||
.text = "Tilt horizontally (slide with 2 fingers)",
|
||||
},
|
||||
{
|
||||
.shortcuts = { "Drag & drop APK file" },
|
||||
|
@ -836,7 +836,7 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im,
|
||||
}
|
||||
|
||||
bool change_vfinger = event->button == SDL_BUTTON_LEFT &&
|
||||
((down && !im->vfinger_down && (ctrl_pressed ^ shift_pressed)) ||
|
||||
((down && !im->vfinger_down && (ctrl_pressed || shift_pressed)) ||
|
||||
(!down && im->vfinger_down));
|
||||
bool use_finger = im->vfinger_down || change_vfinger;
|
||||
|
||||
@ -868,16 +868,28 @@ sc_input_manager_process_mouse_button(struct sc_input_manager *im,
|
||||
// In other words, the center of the rotation/scaling is the center of the
|
||||
// screen.
|
||||
//
|
||||
// To simulate a tilt gesture (a vertical slide with two fingers), Shift
|
||||
// can be used instead of Ctrl. The "virtual finger" has a position
|
||||
// To simulate a vertical tilt gesture (a vertical slide with two fingers),
|
||||
// Shift can be used instead of Ctrl. The "virtual finger" has a position
|
||||
// inverted with respect to the vertical axis of symmetry in the middle of
|
||||
// the screen.
|
||||
//
|
||||
// To simulate a horizontal tilt gesture (a horizontal slide with two
|
||||
// fingers), Ctrl+Shift can be used. The "virtual finger" has a position
|
||||
// inverted with respect to the horizontal axis of symmetry in the middle
|
||||
// of the screen. It is expected to be less frequently used, that's why the
|
||||
// one-mod shortcuts are assigned to rotation and vertical tilt.
|
||||
if (change_vfinger) {
|
||||
struct sc_point mouse =
|
||||
sc_screen_convert_window_to_frame_coords(im->screen, event->x,
|
||||
event->y);
|
||||
if (down) {
|
||||
im->vfinger_invert_x = ctrl_pressed || shift_pressed;
|
||||
// Ctrl Shift invert_x invert_y
|
||||
// ---- ----- ==> -------- --------
|
||||
// 0 0 0 0 -
|
||||
// 0 1 1 0 vertical tilt
|
||||
// 1 0 1 1 rotate
|
||||
// 1 1 0 1 horizontal tilt
|
||||
im->vfinger_invert_x = ctrl_pressed ^ shift_pressed;
|
||||
im->vfinger_invert_y = ctrl_pressed;
|
||||
}
|
||||
struct sc_point vfinger = inverse_point(mouse, im->screen->frame_size,
|
||||
|
@ -94,14 +94,18 @@ the content (if supported by the app) relative to the center of the screen.
|
||||
|
||||
https://github.com/Genymobile/scrcpy/assets/543275/26c4a920-9805-43f1-8d4c-608752d04767
|
||||
|
||||
To simulate a tilt gesture: <kbd>Shift</kbd>+_click-and-move-up-or-down_.
|
||||
To simulate a vertical tilt gesture: <kbd>Shift</kbd>+_click-and-move-up-or-down_.
|
||||
|
||||
https://github.com/Genymobile/scrcpy/assets/543275/1e252341-4a90-4b29-9d11-9153b324669f
|
||||
|
||||
Similarly, to simulate a horizontal tilt gesture:
|
||||
<kbd>Ctrl</kbd>+<kbd>Shift</kbd>+_click-and-move-left-or-right_.
|
||||
|
||||
Technically, _scrcpy_ generates additional touch events from a "virtual finger"
|
||||
at a location inverted through the center of the screen. When pressing
|
||||
<kbd>Ctrl</kbd> the _x_ and _y_ coordinates are inverted. Using <kbd>Shift</kbd>
|
||||
only inverts _x_.
|
||||
only inverts _x_, whereas using <kbd>Ctrl</kbd>+<kbd>Shift</kbd> only inverts
|
||||
_y_.
|
||||
|
||||
This only works for the default mouse mode (`--mouse=sdk`).
|
||||
|
||||
|
@ -53,7 +53,8 @@ _<kbd>[Super]</kbd> is typically the <kbd>Windows</kbd> or <kbd>Cmd</kbd> key._
|
||||
| Open keyboard settings (HID keyboard only) | <kbd>MOD</kbd>+<kbd>k</kbd>
|
||||
| Enable/disable FPS counter (on stdout) | <kbd>MOD</kbd>+<kbd>i</kbd>
|
||||
| Pinch-to-zoom/rotate | <kbd>Ctrl</kbd>+_click-and-move_
|
||||
| Tilt (slide vertically with 2 fingers) | <kbd>Shift</kbd>+_click-and-move_
|
||||
| Tilt vertically (slide with 2 fingers) | <kbd>Shift</kbd>+_click-and-move_
|
||||
| Tilt horizontally (slide with 2 fingers) | <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+_click-and-move_
|
||||
| Drag & drop APK file | Install APK from computer
|
||||
| Drag & drop non-APK file | [Push file to device](control.md#push-file-to-device)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user