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

Add auto lock on reverse direction #6

Closed BlankSourceCode closed 7 months ago

BlankSourceCode commented 7 months ago

This PR adds a new feature Auto Lock on reverse direction which attempts to make mouse follow work more like camera panning in a video game.

With the new option enabled, when moving your mouse to the edge of the screen (how close determined by Follow Border) it will cause the camera to pan in that direction. Instead of continuing to track the mouse until you keep it still, with this setting it will also stop tracking immediately if you move your mouse back towards the center.

It's not 100% like a video game because in a video game, the mouse cursor is drawn independent of where the camera is in the game world. This means you can keep the mouse at the edge of the screen and it will stay at the edge even while the camera pans around. With OBS, the mouse cursor is part of the source, so when the zoom area pans, it also moves the mouse meaning it is no longer at the edge of the screen.

If anyone has suggestions on how to improve the tracking feature, feel free to open an issue.

Also added a function to write out the current settings when you Enable debug logging so help with users filing issues.