UIDragObject has a flag for that -- restrict within panel. If you set it along with the panel region, it won't be possible to exceed the chosen panel's bounds. The math is all there as well, I just call panel.ConstrainTargetToBounds on line 183 of UIDragObject.cs