Search code examples
angulardrag-and-dropdraggableangular-gridster2

Is there a way to set a boundary for dragging element only inside gridster?


Is there a way to set boundaries on the Gridster? Right now I have a behavior, that the gridster item moves halfway out of the grid. I would like that there is a boundary, and drag stops/doesn't allow to drag it more, immediately when you hit the end of Gridster div. So that item is always fully visible. And inside gridster.

In the screenshot below is wrong behavior, this item should be allowed to drag only down, left and right, and not up, as it hits the end of Gridster.

The wrong behavior.


Solution

  • I implemented this feature (boundary check) two weeks ago. As you can see here https://github.com/tiberiuzuld/angular-gridster2/issues/448, you can make use of enableBoundaryControl option. It is released in v13.3.0.