Movable (draggable) rectangular component

We regularly get people asking questions along the lines of “how do I constrain my GUI component when it’s being dragged” and TBH in almost every case they’re asking the wrong question.

There are actually very few use-cases where it’s the GUI that needs to be constrained.

In almost every case where someone asks this, it turns out that they should be constraining their data model instead. Your GUI should always reflect the position of your model, so its position should just take care of itself.

1 Like