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

What is Framer? Join the Community
Return to index
Cemre Güngör
Posted Apr 12 - Read on Facebook

I want to drag in only one axis, and when I override draggable with (view.x = 0) on DragMove, I still sometimes end up with views that are a couple pixels off in the axis I want to make fixed. Is there a better way to do this? Koen Bok


Tisho Georgiev

You can change the speed of the draggable to 0 to constrain movement to a particular direction:

var draggable = new ui.Draggable(view);
draggable.speed.x = 0; // will only be able to drag vertically
draggable.speed.y = 0; // will only be able to drag horizontally

Cemre Güngör

Awesome! Should update my blog post :)

Koen Bok

Yeah the speed is the best one to use for this. Notice you can change it while dragging too. That is how I did the resistance demo:

Read the entire post on Facebook