Preventing window from being dragged off screen

Hello!

I’m getting complaints that my users can drag windows to the edges of the screen, such that it is very difficult to recover them (especially towards the top!)

Is there a way to restrict views to within the visible area of the screen?

I’m aware of alternative solutions to this issue, such as resetting the position of closed windows, but this is not preferred.

Thanks!

I actually ended up working out a simple solution/workaround on my own, here it is for other people who need it in the future. It basically checks whether the distance from the top of the page is negative, and if so, sets it to zero, placing it on top of the page. Super simple!

$$(winId).attachEvent(“onViewMoveEnd”, function(){
if($$(winId).getNode().offsetTop <= -1)
$$(winId).setPosition($$(winId).getNode().offsetLeft,0);
});