hyperframes icon indicating copy to clipboard operation
hyperframes copied to clipboard

feat(studio): support middle-mouse panning in preview

Open func25 opened this issue 6 months ago • 2 comments

What

Add middle-mouse panning to the Studio preview.

Why

This is the convenient and standard way to move around the preview in many visualization platforms.

How

  • Handle preview panning through the shared preview surface instead of an overlay-specific path.
  • Allow panning with the middle mouse button.
  • Keep pan clamped to the real content surface, but add a small overscroll margin so it does not hard-stop at the content edge.

Test plan

How was this tested?

  • [x] Unit tests added/updated
  • [x] Manual testing performed
  • [ ] Documentation updated (if applicable)

func25 avatar May 16 '26 05:05 func25

can you share a video testing it pls?

miguel-heygen avatar May 16 '26 05:05 miguel-heygen

Sure, here is the white scene test video, use midlde-mouse to move around:

https://github.com/user-attachments/assets/ed6e597a-f3f1-4d23-8cec-f852c6f862be

func25 avatar May 16 '26 06:05 func25

Great feature @func25 ! Would you be open to adding trackpad two-finger panning support as well?

This would provide parity with tools like Remotion, where users can pan by dragging with two fingers on their trackpad. It's a common gesture on modern laptops and would make the preview navigation feel more complete.

O1Anas avatar May 16 '26 18:05 O1Anas

Added, thanks for the idea (I saw your recommendation in the zoom in/out GitHub issue also)

func25 avatar May 16 '26 18:05 func25

Thank you so much for the fast response & commit @func25 ! It would be great if we can also include some of these small features/bug fixes in this PR too (or else I'll file a new issue instead, what do you think?):

  1. Mouse wheel/trackpad zoom focuses into the center – Currently, mouse wheel/trackpad zoom always zooms into the center of the composition. It should zoom into the mouse pointer's location for intuitive navigation.

  2. Reset zoom button – Currently, double-clicking on the canvas resets zoom (undocumented/hidden). I Suggest adding a visible, consistent 'Reset Zoom' button.

  3. Canvas border expands inward when zooming – The gray border of the canvas grows thicker and eats into the preview canvas. This was previously reported (see PR #810) and is not fixed (PR was closed & not merged); the issue still happens in the current release and appears connected to CSS zoom vs. transform: scale.

Zoom screenshots:

When zoomed out: Image

When zoomed in: Image

O1Anas avatar May 16 '26 18:05 O1Anas

Let's file a new issue. This PR should only handle panning :)

func25 avatar May 16 '26 18:05 func25

+1 to @func25 let's keep PRs focused and not bloat them to much @O1Anas. All great ideas though!

jrusso1020 avatar May 17 '26 00:05 jrusso1020