Skip to content
This repository has been archived by the owner on Feb 15, 2024. It is now read-only.

It zooms to upper left corner & It does not follow cursor #40

Closed
raspberyl08 opened this issue May 7, 2022 · 31 comments · Fixed by #55
Closed

It zooms to upper left corner & It does not follow cursor #40

raspberyl08 opened this issue May 7, 2022 · 31 comments · Fixed by #55
Assignees
Labels
bug Something isn't working

Comments

@raspberyl08
Copy link

Hello, I have downloaded this and followed all the instructions both in the Github and a tutorial video. However, It zooms to the upper left corner until I can see only a few pixels and it doesn't follow the cursor.

  • downloaded python and script
  • selected source
  • edited script settings
  • added hotkeys
  • edited transform edit

It is my first time downloading a script. Have I missed anything or is there anything missing / broken?

@gabe-over
Copy link

By any chance you have Ultrawide screen(s)?

@raspberyl08
Copy link
Author

By any chance you have Ultrawide screen(s)?

No, just have 1 monitor and 1920 x 1080 pixels

@gabe-over
Copy link

https://github.com/tryptech/obs-zoom-and-follow/tree/pywinctl I figured out this branch works for me.
I can make duplicate tracking, but at least it works on that one scene.

@UBouveron
Copy link

I use a single monitor too and have the same issue. Here is the log:

[zoom_and_follow_mouse.py] Key 'monitor' does not exist in data
[zoom_and_follow_mouse.py] {'method': 0}

By using the 'method' keyword it zooms at the normal view (not until we see just a few pixels) and can return to its previous state. However it's still zoomed in the upper left corner and doesn't follow the cursor. It might be because the follow function uses self.update_window_dim() and not self.update_source_size(), but I'm unsure at this point.

@CodAffection
Copy link

CodAffection commented May 28, 2022

I'm having the same issue.
@tryptech

script log

[zoom_and_follow_mouse.py] Key 'monitor' does not exist in data
[zoom_and_follow_mouse.py] {'capture_cursor': True}

@Ktr4ks
Copy link

Ktr4ks commented Jun 1, 2022

I use a single monitor too and have the same issue. Here is the log:

[zoom_and_follow_mouse.py] Key 'monitor' does not exist in data
[zoom_and_follow_mouse.py] {'method': 0}

Same thing for me.

@martinohanlon
Copy link

Im experiencing the same issue. It zooms all the way into to the far left corner.

Nothing is reported in the Script log.

I have tried the version in master and in pywinctl.

Any thoughts?

@martinohanlon
Copy link

The only solution I found was to use the version from this commit. https://github.com/tryptech/obs-zoom-and-follow/tree/68e1aef99cb2d55a60324e1ea9d48f92815f8949

tryptech added a commit that referenced this issue Jul 19, 2022
-1x1 pixel source issue should be resolved
--Removed window dimension check when resetting window dimensions
--Redetermine source/window/display when reloading OBS
-Clarified comments
-Update README.md
@tryptech
Copy link
Owner

I have updated to try to account for the issue. I have gotten some reports that it works, and some that it doesn't.

@Ktr4ks
Copy link

Ktr4ks commented Jul 19, 2022

I have updated to try to account for the issue. I have gotten some reports that it works, and some that it doesn't.

No changes for me, the problem persists.

@tryptech tryptech self-assigned this Jul 21, 2022
@tryptech
Copy link
Owner

I pushed a fix in the Corner-Zoom-Hotfix branch. It refactors to using window handles in Windows and Linux, but I think it should address the corner zoom in theory.

Please give it a try and let me know if the issue persists. I have some more verbose logging in that branch, so if the zoom still only goes into the top left pixel, please share the script log.

@UBouveron
Copy link

Hello Tryptech! I have a single monitor of 3840*2160. When using a previous commit it zoomed to the upper left according to the defined Zoom Window Width and Zoom Window Height. It didn't follow cursor but was able to go back to full screen from there.

Now with the Corner-Zoom-Hotfix branch, it crops the screen to the defined Zoom Window Width and Zoom Window Height at top left, then zooms into one pixel at the top left, and can only go back to the cropped window. It doesn't follow cursor as well. Here is the log:

[zoom_and_follow_mouse.py] Source update
[zoom_and_follow_mouse.py] Source Name: 
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Source update
[zoom_and_follow_mouse.py] Source Name: Capture d'écran
[zoom_and_follow_mouse.py] Source Type: monitor_capture
[zoom_and_follow_mouse.py] Key 'monitor' does not exist in {'method': 0}

I've tried a different capture method but it just changed from {'method': 0} to 1 and 2 with the same problem.

@tryptech
Copy link
Owner

@UBouveron Can I ask what OS and version of OBS you are using? At least with OBS 27.2.4 on Windows 11 build 22622, I'm encountering a bug where my monitor index is incorrect, but all the data is there.

@UBouveron
Copy link

Sure, I use OBS 27.2.4 on Windows 10 21H2, build 19044.1826.

@tryptech
Copy link
Owner

@UBouveron So I'm not sure exactly why the information doesn't get pulled properly, but to resolve your issue and some other issues at the same time, I added in a monitor override to manually select the monitor that you are trying to track. Check the Corner-Zoom-Hotfix branch again and let me know if that performs any better on your end.

@tryptech
Copy link
Owner

Actually, I think I isolated out the issue. I disconnected all but one of my monitors and I can reproduce a similar error. In the case of one monitor, I think I can force an override with relative confidence so I'm going to go ahead with that.

@UBouveron
Copy link

That's great news! I have updated PyWinCtl to 0.0.38 and for now the behavior is: zooms to top left according to the Zoom Window Width and Zoom Window Height, doesn't follow cursor but can go back to full screen.

If that's helpful, here is the log of the whole process with checked monitor override:

[zoom_and_follow_mouse.py] Source update
[zoom_and_follow_mouse.py] Source Name: 
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Updating Monitor List
[zoom_and_follow_mouse.py] Monitor override list updated
[zoom_and_follow_mouse.py] Updating Source List
[zoom_and_follow_mouse.py] New source: True
[zoom_and_follow_mouse.py] Updating Monitor List
[zoom_and_follow_mouse.py] Monitor override list updated
[zoom_and_follow_mouse.py] Source update
[zoom_and_follow_mouse.py] Source Name: Capture d'écran
[zoom_and_follow_mouse.py] Source update
[zoom_and_follow_mouse.py] Source Name: Capture d'écran
[zoom_and_follow_mouse.py] Source Type: monitor_capture
[zoom_and_follow_mouse.py] Only one monitor detected. Forcing monitor override.
[zoom_and_follow_mouse.py] Updating stored dimensions to match selected monitor's dimensions
[zoom_and_follow_mouse.py] OLD
[zoom_and_follow_mouse.py] Width, Height, X, Y
[zoom_and_follow_mouse.py] 3840, 2160, 0, 0
[zoom_and_follow_mouse.py] NEW
[zoom_and_follow_mouse.py] Width, Height, X, Y
[zoom_and_follow_mouse.py] 3840, 2160, 0, 0

@tryptech
Copy link
Owner

For a moment, I had the same issue happen but I can't reproduce it. We'll have to go step by step to see at what point it's not getting the appropriate mouse coordinates. Commit c563be4 now has logging when you push the zoom button and follow button, and should also give you mouse coordinates every time you zoom in.

@UBouveron
Copy link

UBouveron commented Jul 30, 2022

I have tested the latest commit 499bc63 on Corner-Zoom-Hotfix branch... And it works!! It zooms to the mouse location and follows the cursor as expected. Thank you so much @tryptech!

On a side note, a bad practice that I had was to set the same shortcut for enabling zoom and follow. I thought I needed to activate both at the same time, but actually it follows when you press the zoom alone.

@tryptech
Copy link
Owner

tryptech commented Jul 30, 2022

@UBouveron great to hear! I'll update the readme to recommend setting separate hotkeys to hopefully avoid the confusion in the future.

If no one else has any problems, I'll go ahead and merge the branches after the weekend.

@Ktr4ks
Copy link

Ktr4ks commented Jul 30, 2022

Tried the hotfix branch, and initially It was working just fine, but after messing with it for a while, it started doing this.
obs64_ij125lY7S9
.
Already tried to start clean, but it didn't work.

@tryptech
Copy link
Owner

@Ktr4ks That behavior looks expected. Did you set the bounding box for the source?

@Ktr4ks
Copy link

Ktr4ks commented Jul 31, 2022

@Ktr4ks That behavior looks expected. Did you set the bounding box for the source?

Whops, I forgot about this. It's working now. Thank you very much!
Edit: Display capture works, but game and window capture gives me an error.

@tryptech
Copy link
Owner

@Ktr4ks Can you provide me the script log when it errors? OBS version, Python version, and OS as well if you don't mind.

@Ktr4ks
Copy link

Ktr4ks commented Jul 31, 2022

@tryptech Alright

[zoom_and_follow_mouse.py] Source Type: window_capture
[zoom_and_follow_mouse.py] Handle exists: 525022
[zoom_and_follow_mouse.py] Found Handle Match: 525022
[zoom_and_follow_mouse.py] <Win32Window left="-8", top="-8", width="1936", height="1096", title="Nova guia - Google Chrome">
[zoom_and_follow_mouse.py] Changing target title
[zoom_and_follow_mouse.py] Old Title: Nova guia - Google Chrome
[zoom_and_follow_mouse.py] New Title: Nova guia - Google Chrome
[zoom_and_follow_mouse.py] Proceeding to resize
[zoom_and_follow_mouse.py] Updating stored dimensions to match window's current dimensions
[zoom_and_follow_mouse.py] Traceback (most recent call last):
[zoom_and_follow_mouse.py]   File "C:/Program Files/obs-studio/data/obs-plugins/frontend-tools/scripts\zoom_and_follow_mouse.py", line 641, in toggle_zoom
[zoom_and_follow_mouse.py]     zoom.update_source_size()
[zoom_and_follow_mouse.py]   File "C:/Program Files/obs-studio/data/obs-plugins/frontend-tools/scripts\zoom_and_follow_mouse.py", line 183, in update_source_size
[zoom_and_follow_mouse.py]     self.update_window_dim(self.window)
[zoom_and_follow_mouse.py]   File "C:/Program Files/obs-studio/data/obs-plugins/frontend-tools/scripts\zoom_and_follow_mouse.py", line 56, in update_window_dim
[zoom_and_follow_mouse.py]     if self.source_w != window_dim.right - window_dim.left or self.source_h != window_dim.bottom - window_dim.top or self.source_x != window_dim.left or self.source_y != window_dim.top:    
[zoom_and_follow_mouse.py] UnboundLocalError: local variable 'window_dim' referenced before assignment

OBS version: 27.2.4 64bit.
Python: 3.6.8 64bit
OS: Windows 10 21H2

Edit: I tried with new sources, and sometimes I would get another error, and sometimes it would just zoom to the left up corner, and when I pressed the hotkey to activate zoom and follow, it would zoom to a single pixel. Dunno what I did, but it's now working correctly, at least for now.

Edit 2: I tried again with a new window source, and the problem is back. It only works consistently with display capture.

@tryptech
Copy link
Owner

@Ktr4ks It should be fixed in the commit I just pushed to the hotfix branch. I moved a line I shouldn't have but it should be fine now.

@Ktr4ks
Copy link

Ktr4ks commented Jul 31, 2022

@tryptech Perfect! Everything is working correctly now. Thank you very much!

@tryptech
Copy link
Owner

tryptech commented Aug 1, 2022

I think this fixes most if not all instances of the bug. I'm merging the fix branch in, if anyone has the problem happen again, please open a new issue.

@tryptech tryptech closed this as completed Aug 1, 2022
@royselbach
Copy link

Hello,

I spend a couple of hours on this, but I still have the same problem.
I have 3 connected monitors and the monitor that I would like to have the function work is a 4k (3840 x 2160) monitor.

I tried the hotfix; but the problem remains the same.

After using the hotkey it zooms in in the top left corner and when I press it again it zooms further into; until I can't see anything. After pressing it again it goes back to the top left corner (not the full screen). Also the mouse follow doesn't work.

@royselbach
Copy link

OBS 27.2.4 (64 bit)
Python 3.6 (64 bit)
Windows 11 Pro
OS Build 22000.795

@royselbach
Copy link

Opened new one: #51

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants