Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pinch zooming support #24

Closed
paour opened this issue Mar 10, 2018 · 40 comments
Closed

Pinch zooming support #24

paour opened this issue Mar 10, 2018 · 40 comments

Comments

@paour
Copy link

paour commented Mar 10, 2018

The Android emulator uses right click and drag to simulate pinch zooming. An alternative would be ctrl-mouse wheel.

@octopusknives
Copy link

Pinch zooming with a touchscreen also doesn't work.

@CodeAck
Copy link

CodeAck commented Sep 21, 2018

Pinch zooming support would be a great idea!
Ctrl+← and Ctrl+→ could be used since ↓↑ are taken by volume control.
Would be great for people with low/no motor ability in their hands.
(I can't move from the shoulders down and greatly appreciate what you've done with scrcpy)

@jknut
Copy link

jknut commented Feb 18, 2019

It would be great to have the ability to pinch zoom. Another alternative could be using the mouse wheel.

Scrcpy is really great!

@Pixelstudio
Copy link

Would be great if this can be added!

@apiemont
Copy link

another vote for this feature

@ToggoStar
Copy link

+1! Scrcpy is awesome and this is the only feature missing for me!

@Pixelstudio
Copy link

Oeh i see some references to this pr, but i cannot find if this is implemented...
Any idea?

@rom1v
Copy link
Collaborator

rom1v commented Oct 10, 2019

Hi, I just implemented an experimentation, on branch virtualfinger.

While the Ctrl key is held, the first left-click adds an immobile "virtual finger" at this position.

Moving the mouse moves another cursor. The left click may be released and pressed as necessary to control the second finger.

Releasing Ctrl releases the virtual finger.

@rom1v
Copy link
Collaborator

rom1v commented Oct 10, 2019

A simpler (and maybe more intuitive) alternative could be to always put the "virtual finger" in the center of the screen, so that "unzooming" is more natural.

As a drawback, it would not be possible to zoom on a widget which takes only a portion of the screen (which is not in the center), but it may be worth it.

@CodeAck
Copy link

CodeAck commented Oct 10, 2019

OK cool, so what do we have to do to try this virtualfinger?
Upgrade anything? I'm on a Mac

@srevinsaju
Copy link

srevinsaju commented Oct 11, 2019 via email

@srevinsaju
Copy link

srevinsaju commented Oct 12, 2019

@rom1v I am having problems with the virtualfinger branch,

INFO: scrcpy 1.10 <https://github.com/Genymobile/scrcpy>
/usr/local/share/scrcpy/scrcpy-server.jar: 1 file pushed. 1.1 MB/s (22546 bytes in 0.019s)
INFO: Initial texture: 720x1280
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] WARN: Unknown event type: -1
[server] ERROR: Exception on thread Thread[Thread-1,5,main]
java.lang.IllegalStateException: Buffer full, call next() to consume
        at com.genymobile.scrcpy.ControlMessageReader.readFrom(ControlMessageReader.java:35)
        at com.genymobile.scrcpy.DesktopConnection.receiveControlMessage(DesktopConnection.java:110)
        at com.genymobile.scrcpy.Controller.handleEvent(Controller.java:82)
        at com.genymobile.scrcpy.Controller.control(Controller.java:73)
        at com.genymobile.scrcpy.Server$1.run(Server.java:45)
        at java.lang.Thread.run(Thread.java:764)

Is it due to some installation problem, or some unhandled exception. Running Ubuntu 19.04 scrcpy v1.10 virtualfinger branch.
The mirroring and screen shots continue to work, but the mouse events are not passed not even single and normal click passed.

Sent from my Galaxy Note2 using FastHub

@rom1v
Copy link
Collaborator

rom1v commented Oct 12, 2019

You need to recompile the server too.

@srevinsaju
Copy link

Thanks, will check that way

@srevinsaju
Copy link

srevinsaju commented Oct 12, 2019

@rom1v, no hope, the same error again

What I did


meson x --buildtype release --strip -Db_lto=true
cd x
ninja
cd app
./scrcpy

Unfortunately, the same error comes up. Can't pass clicks as well

Sent from my Galaxy Note2 using FastHub

@Pixelstudio
Copy link

Hi, i have used the branch virtualfinger, that allowed me to simulate pinch-zoom.
However that branch is falling behind compared to the master, any idea if you would implement this in the master ?

@rom1v
Copy link
Collaborator

rom1v commented Jan 15, 2020

The problem is that it is not really usable without a visual feedback (to display which locations are actually clicked), and it requires some work do implement it. So I probably won't merge it without that. 😞

@Pixelstudio
Copy link

ah, that is to bad. scrcpy is really great and the one feature missing for me is the ability to send a pinch command. is it much to work bind for example ctrl + and ctrl - to send a simulated pinch ?

@whaevr
Copy link

whaevr commented Feb 13, 2020

The problem is that it is not really usable without a visual feedback (to display which locations are actually clicked)

would it be possible to hook into the same touch events that the os shows for finger inputs? For example I have the developer option "show touch location" turned on. This works for my finger but not when I click with scrcpy, can scrcpy "use" that same method of tapping the ui that would produce these visual aids people could just turn on in dev options?

Im guessing not

@boorac
Copy link

boorac commented Mar 1, 2020

+1 definitely a great feature

@ahmadshiddiq
Copy link

i cant wait for this feature, for gaming this will be very helpful

@quancayda
Copy link

I'm still waiting for day by day this feature released. It's really helpful for any app/game need Zoom in/out by mouse.
Any update so far for this great feature?

@Voyajer
Copy link

Voyajer commented Aug 1, 2020

Pinch zooming seems to be the only input feature missing from scrcpy. Hopefully it gets implemented because this is very nice software.

rom1v added a commit that referenced this issue Aug 9, 2020
If Ctrl is hold when the left-click button is pressed, enable
pinch-to-zoom to scale and rotate relative to the center of the screen.

Fixes #24 <#24>
@rom1v
Copy link
Collaborator

rom1v commented Aug 9, 2020

Hi,

I finally worked on this feature today.

The problem with my previous attempts is that I wanted to be able to zoom from any point (not only the center of the screen), but it's a UX nightmare. Therefore, I took the same approach as the Android emulator, and just scale/rotate relative to the center of the screen. That way, it's easy to zoom/unzoom.

Just hold Ctrl when you lelf-click to enable pinch-to-zoom (it is disabled when left-click is released). (I used Ctrl because that's what the Android emulator does.)

The branch is pinch_zoom.

Here is a Windows binary to test (replace in your v1.15.1 release):

  • scrcpy.exe
    SHA256: 1b38173837da14e5b134582ba75aa38e166903aaa592cb0b8b10d6ba8a1e61ce

@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2020

Implemented in v1.16.

@elig0n
Copy link

elig0n commented Aug 10, 2020

Anyone else experiencing problem with pinch-zooming maps? Currently experienced in both Google Maps and OSMand.
I seem to not be able to zoom out or in very much because at a certain point the action turns into its opposite, sometimes with the map rotating around itself a full round.
One must hold the mouse pointer at the very pinpoint accurate point where the pointer originally was pressed to be able to keep zooming out or in to farther lengths without turning the map around and/or reversing the zoom operation. For short-step zoom actions there is no such problem so long-step zooming can be achieved only via several, consecutive short-step zooming.

@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2020

Currently experienced in both Google Maps and OSMand.
I seem to not be able to zoom out or in very much because at a certain point the action turns into its opposite, sometimes with the map rotating around itself a full round.

To zoom out, you need to start at the edges (top, bottom, left or right) and moves towards the center.

Imagine that this mode adds a finger inverted through the center:

pinch

(This is a capture from Android emulator, unfortunately scrcpy does not provide any visual feedback, hence the confusion.)

@elig0n
Copy link

elig0n commented Aug 10, 2020

Would you reconsider to reverse the mouse drag directions actions ? i.e to make pulling the mouse towards me zoom out and pulling away from me zoom in ? or maybe the app would need at some point an INI-style configuration file for to reconfigure all the keys.

@rom1v
Copy link
Collaborator

rom1v commented Aug 10, 2020

i.e to make pulling the mouse towards me zoom out and pulling away from me zoom in ?

What do you mean by "pulling towards" or "pulling away"? The screen is 2D and you are in another dimension 😄

Would you reconsider to reverse the mouse drag directions actions ?

In fact, this feature does not implement "zoom in/out", nor choose any drag direction, it just injects additional touch events at a location inverted through the center of the screen. Then the Android app normally reacts to the touch events from the mouse and the virtual finger.

@edulourenzo
Copy link

Good afternoon.
I think the issue is not the zoom of the screen.
And yes, simulate the pinch movement.
An easy way would be:
When pressing a key (alt), two fingers are pressed, pressing the screen from a distance "R" from the mouse position captured with (x, y).
And depending on the scroll of the mouse, these fingers move apart or get closer to the mouse position.
I think the ideal would be diagonally as some photo editors stretch vertically or horizontally. And diagonally this would maintain the proportion.
So you pass the responsibility to the application. If he has zomm the app interacts with the fake fingers. Otherwise the application does nothing.
I think it would not be difficult to simulate the pinch and not the zoom, leave that to the application that is running.
It probably won't work for all cases, but I think it would be a solution for most.

@rom1v
Copy link
Collaborator

rom1v commented Aug 18, 2020

@edulourenzo Isn't more or less what is implemented in v1.16? (except it does not use the mouse scroll)

@edulourenzo
Copy link

And what would be the command to make the zoom pinch movement

@rom1v
Copy link
Collaborator

rom1v commented Aug 19, 2020

Ctrl+click-and-move.

More details: https://github.com/Genymobile/scrcpy/releases/tag/v1.16

@ChristopherH
Copy link

ChristopherH commented Aug 31, 2020

AWESOME! been waiting for this feature for a long time, i love scrcpy but it always lacked that one major feature, thanks alot to all developers, you are doing a terrific job!

@alimsk
Copy link

alimsk commented Sep 20, 2021

no longer working?
i'm on linux
android 10

@rom1v
Copy link
Collaborator

rom1v commented Sep 20, 2021

Yes, it is working: https://github.com/Genymobile/scrcpy#pinch-to-zoom

Which version of scrcpy do you use?

@alimsk
Copy link

alimsk commented Sep 20, 2021

i use

$ scrcpy --version
scrcpy 1.12.1

dependencies:
 - SDL 2.0.10
 - libavcodec 58.54.100
 - libavformat 58.29.100
 - libavutil 56.31.100

@alimsk
Copy link

alimsk commented Sep 20, 2021

i rebuild scrcpy from source code and it suddenly worked 😕

@rom1v
Copy link
Collaborator

rom1v commented Sep 20, 2021

scrcpy 1.12.1

It's a very old version, pinch zoom has been implemented in 1.16.

@alimsk
Copy link

alimsk commented Sep 20, 2021

i installed it with apt install scrcpy.
anyways thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests