Search code examples
angularprimengprimeng-dialog

How can I prevent off the screen the dragging of a p-dialog from PrimeNG


I'm using p-dialog from PrimNG. With [draggable] enabled, I can prevent the modal from being dragged off-screen on the left and top using [minX] and [minY].

Is there a way to prevent the modal from being dragged off-screen on the right and bottom?

I am using https://www.primefaces.org/primeng/#/dialog in a pretty standard implementation.


Solution

  • As '[minX]' is the minimum draggable coordinates to the left and '[minY]' is the minimum draggable coordinates to the top, set them to a large negative number i.e. [minX]="-1000" [minY]="-1000" . In this way you will be able to drag the dialog much more to the left and top.