This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Oli Askew
Posted Dec 08 - Read on Facebook

Hey Framers, does anyone happen to know how to dynamically update a scroll component's scroll constraints when the layer is made pinchable? In this example, when I pinch to zoom into the image I can no longer scroll to the edges. When I zoom out I can scroll the layer out of view. Any advice much appreciated!


Márcio Ribeiro

hey Oli, have you tried use a layer with draggable enabled instead of using a scroll component?

Oli Askew

Hey Márcio Ribeiro thanks for the reply - yes I did actually try this last week using a basic draggable example and got this far .
As you will see though, it's along the right lines but still doesn't feel right; the constraints start to mutate disproportionately to the draggable layer and zooming out after zooming in seems especially painful! I thought there must be a more graceful way, or perhaps I just ran out of maths... :)

Oli Askew

Actually just to give the code more context - no, the constraints still cannot be dynamically altered when scaling a draggable layer. What I'm doing in the example is attempting to 'fake' the scale by reducing the scale factor to a much smaller arbitrary value and then altering the physical proportions of the layers themselves to compensate the zoom back to the original scale factor - if that makes any sense!

Read the entire post on Facebook