Resource icon

Zoom to Mouse 1.0.1

I've installed this on my dual monitor setup and nothing happens, i get no errors or anything, hotkeys are set, but no zooming is occurring
Are you on Windows? Have you added a display capture source to your scene and then selected that as the Zoom Source from the dropdown in the script settings? Is the Zoom Factor set to something above 1?

Could you enable debug logging and then reply with the script log in case it shows what the issue is. Without more information its impossible to tell you what the problem might be, but it definitely works with a dual monitor setup, as that is what I use.
 
BlankSourceCode updated Zoom to Mouse with a new update entry:

Added support for Mac and Linux

If you are using OBS on linux or mac, you should now be able to use this script to zoom to a display capture source on those platforms too!

This update also fixes a few issues with blinking and adds some new settings for those who need to customize the size/position of the source.

Thanks for all the support so far and enjoy the new version.

Read the rest of this update entry...
 

noizeproxy

New Member
LOVE THIS! I struggled so much with the Python versions. Almost gave up entirely until I stumbled upon this one recently... I was having that blinking issue, but you solved that, so thank you! Although, OBS is still crashing everytime I try to close it. Is there a workaround for this? It is most definitely the script, because I'll delete it, and the crashing stops. I can't even remove the lua from within OBS without it crashing, so I have to close out, delete the lua from my scripts folder, and then go back to OBS to take care of the rest; crashing stops...

Anyways, I'm attaching the crash report. I'm not sure if I'm the only one with this issue, but hopefully there's some sort of workaround, because it nullifies some of the changes I make with docks and other settings in OBS when it crashes every time. That being said, still a great tool, so thank you!
 

Attachments

  • Crash 2023-12-01 15-44-55.txt
    150 KB · Views: 20
Anyways, I'm attaching the crash report. I'm not sure if I'm the only one with this issue, but hopefully there's some sort of workaround, because it nullifies some of the changes I make with docks and other settings in OBS when it crashes every time. That being said, still a great tool, so thank you!
That crash says it's trying to unregister the hotkey handler during unload.

You could probably get away with just deleting those two lines in the script (1267 and 1268):


Some scripts don't even call unregister hotkey during unload so maybe I'm not supposed to? I'm not sure.

Try editing the Lua file in any text editor and deleting those two lines, save, and reopen OBS.

Let me know if that at least stops the crash.

Thanks!
 

noizeproxy

New Member
That crash says it's trying to unregister the hotkey handler during unload.

You could probably get away with just deleting those two lines in the script (1267 and 1268):


Some scripts don't even call unregister hotkey during unload so maybe I'm not supposed to? I'm not sure.

Try editing the Lua file in any text editor and deleting those two lines, save, and reopen OBS.

Let me know if that at least stops the crash.

Thanks!
Unfortunately no :/

Attached the new crash report. I tried reading it, but I honestly have no idea what I'm looking at...
 

Attachments

  • Crash 2023-12-01 21-19-16.txt
    150 KB · Views: 28
Unfortunately no :/

Attached the new crash report. I tried reading it, but I honestly have no idea what I'm looking at...
Now it's complaining about the next line where it removes the event callback.

It seems like it just doesn't want to do any cleanup when the script is unloaded.

I see you are on OBS 29.1.2, I don't think I tried it on that version.

Try just changing line 1257 so that it checks for major > 29.5 instead of 29.0

That'll skip the cleanup and hopefully allow you to close.
 

jh-mobile

New Member
1.
After installing it worked once (zooming + auto follow).
2.
After restarting obs i got an error due to the loading of the lua-script
3.
I uninstalled an installed it the lua-script again
4.
Since this time i have always an offset (horizontal) when activating zooming
The mouse cursor is therefore not visibel in the zoomed area
5.
Neither restarting the computer nor uninstalling/installing solves this
6.
Trying with a new portable version it worked as it should (see point 1)
After closing this new obs version and restarting again --> Same offset as described in point 4 (but no errors)
-->
Why does the script only work once in a virgin obs version?
 
1.
After installing it worked once (zooming + auto follow).
2.
After restarting obs i got an error due to the loading of the lua-script
3.
I uninstalled an installed it the lua-script again
4.
Since this time i have always an offset (horizontal) when activating zooming
The mouse cursor is therefore not visibel in the zoomed area
5.
Neither restarting the computer nor uninstalling/installing solves this
6.
Trying with a new portable version it worked as it should (see point 1)
After closing this new obs version and restarting again --> Same offset as described in point 4 (but no errors)
-->
Why does the script only work once in a virgin obs version?
What was the error?

What version of OBS, OS, and script are you using?

What kind of zoom source are you using?

The script stores state through the official OBS Lua settings so maybe that is getting corrupted on your computer somehow.

Some reasons I can think of for having a random offset are:

The script is incorrectly calculating the position of the source (which you can fix by manually entering the correct position via Set magical source position).

Your source has some manual filter or transform applied which is causing an issue with zooming. Try setting zoom source to None, then resetting your source transform, removing any filters, then setting the zoom source back.
 

RiccyBobby

New Member
This is amazing! Thanks so much for working on it so actively! I've got an issue where I've installed the script, set up my hotkeys for zoom and follow etc. But when it zooms in it isn't zooming to the exact point of my mouse, it's mostly favoring the top left. I checked if i had manual position checked and that's off so I'm stumped. Any ideas?
 
This is amazing! Thanks so much for working on it so actively! I've got an issue where I've installed the script, set up my hotkeys for zoom and follow etc. But when it zooms in it isn't zooming to the exact point of my mouse, it's mostly favoring the top left. I checked if i had manual position checked and that's off so I'm stumped. Any ideas?
Are you on latest OBS on Windows?

Do you have any transform/filters set on the source that might be interfering with the calculations?

Is the source the same size as your canvas? I know there is an issue with the positioning when your source is using a bounding box transform where it ends up a different aspect ratio to the canvas.

If you turn on debug logging and copy the script log it might help me figure out what's happening.

Opening a new GitHub issue with that log and/or any other information would be useful.

Sorry you are having issues.
 

RJ-RDHS

New Member
Is this compatible with M1/M2 Macs? I installed the script and selected hotkeys, but the zoom sources shows empty. <none>
 
Is this compatible with M1/M2 Macs? I installed the script and selected hotkeys, but the zoom sources shows empty. <none>
It should work, are you on the latest version of OBS?

Try enabling the 'Show all sources' option which should skip the display source check and populate the drop-down with everything.

You could also enable debug logs and see if it mentions any errors
 

Loosha

New Member
Hi guys, there is a bug that occurs when using the script to capture and zoom in on window capture of a browser tab.

I was trying to use "zoom on any source" and selected a window capture of my open browser (Chrome). It woked and it zooms fine, HOWEVER any adjustments made to the size of the source (cropping via ALT+dragging, resizing, transforming, etc.) are NOT carried over.

As soon as you switch scenes, all your resizing adjustments go out the window and the window capture is full size again.

ALSO using the script prevents from being able to use CLIENT AREA on a windowed source of a browser (in my example).

Normally, I select window capture, choose my open browser window, then pick 'Client Area' to only capture that. With your script running, however, toggling that option has no effect.

What I'm trying to do:
I'm on a widescreen monitor. One third of that is used up by my open Chrome browser. I want to capture only the client area of that browser tab and then zoom and follow within only that client area.

Additional note:
Doing a display capture is NOT an option because that shows superfluous elements i.e. the mouse cursor or tab preview thumbnails that are all filtered out when using window capture and client area option.
 

svOzt

New Member
i've got a bug too, it wont Zoom and follow.
i try to refresh zoom Source, its not blinking like the first time i installed.
its not working with Display capture or other source. in my case Web browser source. both not working.
some screenshot of the Log.
1. When i press Refresh zoom sources
2. Turn On Zoom and Track mouse with hotkeys
3. Turn Off Zoom and Track mouse with hotkeys
Script Log.png
 
Hi guys, there is a bug that occurs when using the script to capture and zoom in on window capture of a browser tab.

I was trying to use "zoom on any source" and selected a window capture of my open browser (Chrome). It woked and it zooms fine, HOWEVER any adjustments made to the size of the source (cropping via ALT+dragging, resizing, transforming, etc.) are NOT carried over.

As soon as you switch scenes, all your resizing adjustments go out the window and the window capture is full size again.

ALSO using the script prevents from being able to use CLIENT AREA on a windowed source of a browser (in my example).

Normally, I select window capture, choose my open browser window, then pick 'Client Area' to only capture that. With your script running, however, toggling that option has no effect.

What I'm trying to do:
I'm on a widescreen monitor. One third of that is used up by my open Chrome browser. I want to capture only the client area of that browser tab and then zoom and follow within only that client area.

Additional note:
Doing a display capture is NOT an option because that shows superfluous elements i.e. the mouse cursor or tab preview thumbnails that are all filtered out when using window capture and client area option.

The script works best with display capture sources, everything else is a best guess on the part of the script and so need a bunch of manual tweaking.

When you select a source from the `Zoom Source` dropdown, the script stores the current state of that source's transform and crop settings at that point. When you change scenes, close OBS, remove the script (or any other way you might stop the script), it returns the source settings back to those stored original values. This is to prevent issues with things getting messed up with your layout like it can with certain other approaches to zooming.

With that, there is also an issue with non-display capture sources where OBS gives incorrect values for the transform crop, so I disabled that bit of the code. If you want to try having the script use those crop values anyway, you will need to edit the script. Look for the comment
-- Non-Display Capture sources don't correctly report crop values (around line 572) and comment out the code that sets each value to zero (aka. prefix the next 4 lines each with --). That will have the script save/load the crop values for non-display capture sources.

The "supported" way to do it I put in the readme, but what you have to do is use a manual crop/pad filter set to non-relative instead. So, you would select <None> on the Zoom Source dropdown (so that the transform goes back to original), then add a new crop/pad filter to the source, uncheck Relative, set the x/y/width/height of that filter to be whatever you want. And finally reselect the source in the dropdown to save those new values. Though even then the script might act odd because its still not a display source (ymmv).

For the client area not working, does it do anything if you uninstall the script? I don't know what browser you are using, but most modern ones don't have separate client and non-client areas anymore, they override and render their own window so clicking the 'client area' checkbox doesn't change anything as both sizes reported by Windows are the same (maybe you aren't on Windows and it works differently?). Not sure how the script could be interfering with that unless it's done in OBS via the transform, but I'd need to repro it on my end to be able to see what's going on.

If you can manage to crop the source to your liking (while Zoom Source is set to <None>), you'll probably also need to use the `Set manual source position` option. The script won't be able to auto calculate the position of the window source (since OBS doesn't say). You'll need to figure out the exact X/Y pixel coordinates of the left/top of the part of the window you have shown as well as the Width/Height of the cropped part, along with the size of your monitor that the window is displayed on. Once you set those the script should (hopefully) zoom correctly on the cropped part.

Thanks for trying the script.
 
Any updates or at least aknowledgement that you're aware of the bug dear devs? See my post above.
Hehe, "Devs". I wish! It's just me in what (little) spare time I have, I'm afraid.

You are acknowledged. Hopefully the previous reply helped you get something working. If not, let me know any other information that might help and I can try to figure out some other part of the script you may need to tweak.
 
i've got a bug too, it wont Zoom and follow.
i try to refresh zoom Source, its not blinking like the first time i installed.
its not working with Display capture or other source. in my case Web browser source. both not working.
some screenshot of the Log.
1. When i press Refresh zoom sources
2. Turn On Zoom and Track mouse with hotkeys
3. Turn Off Zoom and Track mouse with hotkeys

Clicking the `Refresh zoom sources` button will only repopulate the dropdown with all the sources it can find (in case you add a new one you want to select). It doesn't actually reset any values. To do that you actually need to change the drop down to <None> and then change it back to whichever zoom source you want to recalculate.

From the log it looks like the script isn't able to parse the information about the size and position of your display (aka monitor). Could you show me what OBS is calling your display in its properties? Like this:

1705511007717.png


That is where the script gets its information.

You could also try out the suggestion in the warning, by selecting the `Set manual source position` option in the script settings. You'll then need to set the x/y, width/height and monitor width/height values in there. For example, if I was using my display above, I would write
x: 0
y: 0
width: 3840
height: 2160
scaleX: 1
scaleY: 1
monitor width: 3840
monitor height: 2160

Usually this option is only needed for non-display capture sources which would have different values for the width/height (of the source) and monitor width/height. But it should work fine if you set them to the same value for an actual display source.

Hopefully that helps.
 

Loosha

New Member
The script works best with display capture sources, everything else is a best guess on the part of the script and so need a bunch of manual tweaking.

When you select a source from the `Zoom Source` dropdown, the script stores the current state of that source's transform and crop settings at that point. When you change scenes, close OBS, remove the script (or any other way you might stop the script), it returns the source settings back to those stored original values. This is to prevent issues with things getting messed up with your layout like it can with certain other approaches to zooming.

With that, there is also an issue with non-display capture sources where OBS gives incorrect values for the transform crop, so I disabled that bit of the code. If you want to try having the script use those crop values anyway, you will need to edit the script. Look for the comment
-- Non-Display Capture sources don't correctly report crop values (around line 572) and comment out the code that sets each value to zero (aka. prefix the next 4 lines each with --). That will have the script save/load the crop values for non-display capture sources.

The "supported" way to do it I put in the readme, but what you have to do is use a manual crop/pad filter set to non-relative instead. So, you would select <None> on the Zoom Source dropdown (so that the transform goes back to original), then add a new crop/pad filter to the source, uncheck Relative, set the x/y/width/height of that filter to be whatever you want. And finally reselect the source in the dropdown to save those new values. Though even then the script might act odd because its still not a display source (ymmv).

For the client area not working, does it do anything if you uninstall the script? I don't know what browser you are using, but most modern ones don't have separate client and non-client areas anymore, they override and render their own window so clicking the 'client area' checkbox doesn't change anything as both sizes reported by Windows are the same (maybe you aren't on Windows and it works differently?). Not sure how the script could be interfering with that unless it's done in OBS via the transform, but I'd need to repro it on my end to be able to see what's going on.

If you can manage to crop the source to your liking (while Zoom Source is set to <None>), you'll probably also need to use the `Set manual source position` option. The script won't be able to auto calculate the position of the window source (since OBS doesn't say). You'll need to figure out the exact X/Y pixel coordinates of the left/top of the part of the window you have shown as well as the Width/Height of the cropped part, along with the size of your monitor that the window is displayed on. Once you set those the script should (hopefully) zoom correctly on the cropped part.

Thanks for trying the script.
Thanks for the reply. This is so complicated. I'm not sure I'm even able to understand everything you wrote, let alone perform all the tweaks - especially since you say that none of this is tested and may not even work anyway.

I'm on Windows 10 trying to capture my Chrome browser window ideally using 'client area' to cut out all the overlays.
 

svOzt

New Member
Clicking the `Refresh zoom sources` button will only repopulate the dropdown with all the sources it can find (in case you add a new one you want to select). It doesn't actually reset any values. To do that you actually need to change the drop down to <None> and then change it back to whichever zoom source you want to recalculate.

From the log it looks like the script isn't able to parse the information about the size and position of your display (aka monitor). Could you show me what OBS is calling your display in its properties? Like this:

View attachment 100988

That is where the script gets its information.

You could also try out the suggestion in the warning, by selecting the `Set manual source position` option in the script settings. You'll then need to set the x/y, width/height and monitor width/height values in there. For example, if I was using my display above, I would write
x: 0
y: 0
width: 3840
height: 2160
scaleX: 1
scaleY: 1
monitor width: 3840
monitor height: 2160

Usually this option is only needed for non-display capture sources which would have different values for the width/height (of the source) and monitor width/height. But it should work fine if you set them to the same value for an actual display source.

Hopefully that helps.
i try use that Set manual source position, still not work.
pretty much nothing change to in that width & height.
since my display capture monitor is 1080p
1705530965432.png

1705531008037.png


and also i use 2nd script but for browser only. both not working for me now.
1705531095773-png.101005

sorry if to many screenshot :x
 

Attachments

  • 1705531095773.png
    1705531095773.png
    31.1 KB · Views: 160
Top