Banner/rectangle limits in horizontal drag


#1

guys i want to ask
how do you make the banner / rectangle can be dragged left or right with drag restrictions?

in the project that I created, this banner is capable of being dragged to left, but without having the drag limit itself and disappears on the artboard

*sorry for bad english

banner slider.rp (43.9 KB)


#2

To specify limits on moving a widget, you need to look under MORE OPTIONS and then click +Add Boundary --circled in this screenshot:

In your case, you’d want to specify a left boundary and a right boundary, with rules for when the movement can occur. It is not clear where you would like to limit the movement, but assuming you want to stop the banner movement when its left reaches the left edge of the screen area and when its right reaches the right edge of the screen area, the rules would be:
left is less than 0
right is greater than [[Window.width]]
(…where [[Window.width]] is a built-in variable)

Since your initial position of the banner is at x=22, I will further assume you want to keep this as a “margin” for the left and the right. This would result in these boundaries:
left is less than 22
right is greater than [[Window.width -22]]

See this updated file:
banner slider.rp (44.6 KB)


#3

yeah thanks for your help bro
and may I ask one more thing?

how to make pagination and pictures swipe, like this
5wQCY