Mobile slide menu

I want to make a horizontal slide menu out of 8 buttons for mobile portrait mode. Only 4 are visible at a time and the rest off screen. With a limit so that you don’t see an empty space. e.g. like the screenshots in google play store.
I tried something but it works badly.


ezgif-5-b293271a24

I had a scrolling system where I placed markers on either end of the row. If the left marker was on screen, then the buttons couldn’t be moved right. Similalry, if the right marker was on screen, the buttons couldn’t be moved to the left.

The left marker never changed, but the right marker moved as buttons were added or removed.

Which condition to check that?
And the biggest problem is, the buttons don’t stop when the slider object stops. They are leaving the position on the slider for no reason. And when I tap on it it jumps directly.
I’ll keep thinking about it, if anyone has an idea or example please let me know.
If it doesn’t really work I can also use buttons, but it would be cool to slide things like in many mobile games.

Something along the lines of

If the left marker's X pos < 0 then allow right scrolling of the buttons.
and
If right marker's X pos > screenwidth, then allow left scrolling of the buttons.

And move the markers with the buttons. Or continuously place them to the left and right of the buttons, so it changes as the number of buttons change.

Thats how it works now. :slight_smile:

But when I want to use another layer instead of Base Layer, it moves very quickly and uncontrolled. I noticed this a already few months ago. Is this a “bug” in the extension? @ddabrahim

Why are you dragging the camera before you check whether the bounds have been breached? What happens if you check first, and then drag the camera?

Then it stuck when I reach a limit because then the position is 1px outside of the range. Works fine as is. (till now only tested on Pc)

Can you clamp the value?

1 Like

I don’t really know but if I can help : I think a cool way to avoid this problem is to add up and down buttons…