@@ -624,6 +624,7 @@ class CommentDialog {
624624 this . #prevDragY = clientY ;
625625 pointerMoveAC = new AbortController ( ) ;
626626 const { signal } = pointerMoveAC ;
627+ const { innerHeight, innerWidth } = window ;
627628 dialog . classList . add ( "dragging" ) ;
628629 window . addEventListener (
629630 "pointermove" ,
@@ -633,8 +634,8 @@ class CommentDialog {
633634 }
634635 const { clientX : x , clientY : y } = ev ;
635636 this . #setPosition(
636- this . #dialogX + x - this . #prevDragX,
637- this . #dialogY + y - this . #prevDragY
637+ this . #dialogX + ( x - this . #prevDragX) / innerWidth ,
638+ this . #dialogY + ( y - this . #prevDragY) / innerHeight
638639 ) ;
639640 this . #prevDragX = x ;
640641 this . #prevDragY = y ;
@@ -693,16 +694,14 @@ class CommentDialog {
693694 this . #uiManager?. removeEditListeners ( ) ;
694695 this . #saveButton. disabled = true ;
695696 const parentDimensions = options ?. parentDimensions ;
697+ const { innerHeight, innerWidth } = window ;
696698 if ( editor . hasDefaultPopupPosition ( ) ) {
697699 const { dialogWidth, dialogHeight } = this . _dialogDimensions ;
698700 if ( parentDimensions ) {
699701 if (
700702 this . #isLTR &&
701703 posX + dialogWidth >
702- Math . min (
703- parentDimensions . x + parentDimensions . width ,
704- window . innerWidth
705- )
704+ Math . min ( parentDimensions . x + parentDimensions . width , innerWidth )
706705 ) {
707706 const buttonWidth = this . #editor. commentButtonWidth ;
708707 posX -= dialogWidth - buttonWidth * parentDimensions . width ;
@@ -717,13 +716,15 @@ class CommentDialog {
717716 }
718717 }
719718 const height = Math . max ( dialogHeight , options ?. height || 0 ) ;
720- if ( posY + height > window . innerHeight ) {
721- posY = window . innerHeight - height ;
719+ if ( posY + height > innerHeight ) {
720+ posY = innerHeight - height ;
722721 }
723722 if ( posY < 0 ) {
724723 posY = 0 ;
725724 }
726725 }
726+ posX /= innerWidth ;
727+ posY /= innerHeight ;
727728 this . #setPosition( posX , posY ) ;
728729
729730 await this . #overlayManager. open ( this . #dialog) ;
@@ -752,8 +753,8 @@ class CommentDialog {
752753 this . #dialogX = x ;
753754 this . #dialogY = y ;
754755 const { style } = this . #dialog;
755- style . left = `${ x } px ` ;
756- style . top = `${ y } px ` ;
756+ style . left = `${ 100 * x } % ` ;
757+ style . top = `${ 100 * y } % ` ;
757758 }
758759
759760 #finish( ) {
0 commit comments