fix(components): [dialog] drag into view when content is too high (#20595)

This commit is contained in:
Nick Wu
2025-06-03 22:59:49 +08:00
committed by GitHub
parent b31e727edd
commit a48b496ba5

View File

@@ -28,7 +28,11 @@ export const useDraggable = (
const minLeft = -targetLeft + offsetX
const minTop = -targetTop + offsetY
const maxLeft = clientWidth - targetLeft - targetWidth + offsetX
const maxTop = clientHeight - targetTop - targetHeight + offsetY
const maxTop =
clientHeight -
targetTop -
(targetHeight < clientHeight ? targetHeight : 0) +
offsetY
if (!overflow?.value) {
moveX = Math.min(Math.max(moveX, minLeft), maxLeft)