@@ -674,6 +674,8 @@ function getNowPosition(addSizeX: number, addSizeY: number) {
674674 let nowSizeY = infoBox .value .oldSizeY
675675 let nowX = infoBox .value .oldX
676676 let nowY = infoBox .value .oldY
677+ // Move the lowest position from point L
678+ const nowBottomX = nowX + nowSizeX - 1
677679 if (hasR ) {
678680 nowSizeX = Math .max (nowSizeX + addSizeX , 1 )
679681 }
@@ -683,7 +685,8 @@ function getNowPosition(addSizeX: number, addSizeY: number) {
683685
684686 if (hasL ) {
685687 nowSizeX = Math .max (nowSizeX - addSizeX , 1 )
686- nowX = Math .max (nowX + addSizeX , 1 )
688+ // Move the lowest position from point L
689+ nowX = Math .min (Math .max (nowX + addSizeX , 1 ), nowBottomX )
687690 }
688691
689692 if (hasT ) {
@@ -705,6 +708,10 @@ function getNowClonePosition(moveXSize: number, moveYSize: number) {
705708 let nowOriginHeight = infoBox .value .originHeight
706709 let nowOriginX = infoBox .value .originX
707710 let nowOriginY = infoBox .value .originY
711+ // Move the lowest position from point T
712+ const nowBottomOriginY = nowOriginY + nowOriginHeight - baseHeight .value
713+ // Move the lowest position from point L
714+ const nowBottomOriginX = nowOriginX + nowOriginWidth - baseWidth .value
708715 if (hasR ) {
709716 nowOriginWidth = Math .max (nowOriginWidth + moveXSize , baseWidth .value )
710717 }
@@ -714,12 +721,14 @@ function getNowClonePosition(moveXSize: number, moveYSize: number) {
714721
715722 if (hasL ) {
716723 nowOriginWidth = Math .max (nowOriginWidth - moveXSize , baseWidth .value )
717- nowOriginX = Math .max (nowOriginX + moveXSize , 1 )
724+ // Move the lowest position from point L
725+ nowOriginX = Math .min (Math .max (nowOriginX + moveXSize , 1 ), nowBottomOriginX )
718726 }
719727
720728 if (hasT ) {
721729 nowOriginHeight = Math .max (nowOriginHeight - moveYSize , baseHeight .value )
722- nowOriginY = Math .max (nowOriginY + moveYSize , 1 )
730+ // Move the lowest position from point L
731+ nowOriginY = Math .min (Math .max (nowOriginY + moveYSize , 1 ), nowBottomOriginY )
723732 }
724733 return {nowOriginWidth , nowOriginHeight , nowOriginX , nowOriginY }
725734}
0 commit comments