When we have a layer,…
blueSquare = new Layer size: 300, borderRadius: 11 backgroundColor: "#28AFFA" point: Align.center
…making it draggable could not be easier:
blueSquare.draggable.enabled = yes
Draggable layers come with simulated physics: when you throw the layer, it will keep moving with momentum before eventually coming to a standstill. You can even toss it off-screen.
A simple draggable layer
But maybe we should constrain our layer, so we don’t lose it.