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

What is Framer? Join the Community
Return to index
Chris Camargo
Posted Apr 27 - Read on Facebook

Coming across some odd and unexpected behavior with states and draggable/pinchable layers.

Here I have a map layer that is positioned in the middle of the view. I can drag to pan and pinch to zoom. The "Reset" button calling mapLayer.states.switch("default") to get the map back to its default positioning, but things are getting weird...

2 issues –

1. The reset button does not work reliably. I can pan the map layer and then tap Reset, and its possible that nothing may happen. Not sure what the repro is here. Sometimes it resets the state properly, sometimes it does nothing at all. And sometimes it moves the layer to an X/Y that doesn't match the default state.

2. When the scale of the map layer is adjusted and I'm able to successfully trigger the Reset state switch, the map layer moves in a really unusual arc. I just want to move directly back to the original position and scale in a linear movement.

Anyone have pointers on how I can mitigate these issues?


JL Flores Mena

I got it to work in this version:

But I really don't know what the error was.
I changed .onClick for the good old .on Events.Click.
And "default" state may not be that reliable, I created a new one instead.

But definitely worth checking out what the issue is, because I feel like I did the same thing you were doing before.

Chris Camargo

This is odd... Applying the values myself in a custom state works, but I'm still getting the crazy arc movement in some cases when the map layer changes scale. cc Koen

Koen Bok

I'll check this out. Bit overloaded :-)

Chris Camargo

Any love for this one, Koen?

Read the entire post on Facebook