-
Notifications
You must be signed in to change notification settings - Fork 28.5k
InteractiveViewer should allow us to easily customize the inertia physics #71676
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Removed the web label as this applies to all platforms. |
Maybe InteractiveViewer should have something like ScrollPhysics? |
I was able to get something similar by changing the
|
For my use case, the friction/inertia was messing with an animation I wanted to trigger once the user stops scaling the viewer. I ended up just making a copy of the source code for InteractiveViewer and commenting out line 969, which disables it:
There really should be an option for this though. Something similar to ScrollPhysics would be cool, but at least setting the |
Hi there,
But I can't reproduce it on my devices.
I don't set the Do you know how can I fix this crash? |
The |
Setting |
I've had a go implementing ScrollPhysics in InteractiveViewer by constructing 'synthetic' ScrollMetrics for the InteractiveViewer and applying the physics from the specified ScrollPhysics to offsets outside of the bounds. I've also tried to leverage the ScrollPhysics in the case of zooming beyond maxScale and below minScale. Obviously ScrollPhysics doesn't currently consider zooming, so I took the approach of calculating the extent the content bounds would be exceeded when zooming beyond the maxScale and applying the ScrollPhysics to that offset to provide friction (in the case of BouncingScrollPhysics). Is this the kind of thing you had in mind? |
On desktop and web, it is usually not desired to have inertia, when using these types of viewers with mouse.
Behavior is variable. For example Adobe XD, or Figma, when you drag an artboard and release, it's a hard stop. On photoshop though, it uses inertia.
It would be nice if we could supply our own drag coefficient (
kDrag
), or our own FrictionSimulation entirely.To think a bit beyond that though, Unity has a very similar component, but it has configuration options that are more flexible.

Some config options that would be nice for a widget of this type, from a production perspective:
The text was updated successfully, but these errors were encountered: