BlankSourceCode / obs-zoom-to-mouse

An OBS lua script to zoom a display-capture source to focus on the mouse
178 stars 15 forks source link

Unable to cover full bounding box on super ultra wide #30

Open Hezkore opened 4 months ago

Hezkore commented 4 months ago

My monitor is 5120 x 1440, so the image is very wide. I have my bounding box for the desktop capture set to 1920 x 1080 and "Scale to inner bounds". But when I zoom in it doesn't actually cover the entire bounding box, it only covers what it already renders.

Is there a way to fix this? I've attached a video demonstrating this, notice the black bars at the top and bottom.

https://github.com/BlankSourceCode/obs-zoom-to-mouse/assets/1727541/84b1119f-cc48-4add-968b-0363ef5ab1f3

Hezkore commented 4 months ago

I'm not exactly sure how the "Set manual source position" option works, but I've modified the code so that it at least makes sense to me.

By changing these lines: https://github.com/BlankSourceCode/obs-zoom-to-mouse/blob/53dc1a5425c2a96db34fb34aae40283f84bf1720/obs-zoom-to-mouse.lua#L786-L789

To:

local new_size = {
    width = monitor_override_w / zoom.zoom_to,
    height = monitor_override_h / zoom.zoom_to
}

I get the expected result when setting "Monitor Width" to 5120 and "Monitor Height" to 1440, then "Width" to 1920 and "Height" to 1080 in the "Set manual source position" menu.

I've attached a video demonstrating this.

https://github.com/BlankSourceCode/obs-zoom-to-mouse/assets/1727541/c29df7ed-af0d-47dd-978e-30c9caed2e25

BlankSourceCode commented 4 months ago

@Hezkore That's a great workaround. I suspect the change may break some scenarios depending on the sort of zoom source and/or crop values it might have, but I'm glad you got it working for your case.

To be honest, there are so many different sizes and positions in the script now that even I get confused about what they all do. I probably need to overhaul them at some point.

Thanks for posting this, I'm going to point some others at it to see if the same workaround fixes their issue.

ibrah3m commented 4 months ago

worked

estebandelpino commented 4 months ago

Worked for me too! Thank you for sharing :)

chriszuko commented 2 months ago

I might cry. Finally a zoom script that works. Thank you so much for posting this workaround for ultrawide.

MajorWookie commented 2 months ago

I think I have a similar issue. My monitor size is 3840x2160, but I have it scaled down to 1920x1080 for readability in my settings. My zoom doesn't quite zoom in on the cursor, nor does it follow it. Here is a gif

2024-05-09_17-53-34 (2)

transform setting

2024-05-09_17-57-25

Script setting

2024-05-09_17-57-10
MajorWookie commented 1 month ago

Update: I was able to resolve my issue.

1) Checked my Video setting. Made the base (Canvas) Resolution the same as my monitor resolution.

2024-05-09_23-04-17

2) Set manual source potion to the below

2024-05-09_23-07-20