[Editor] Make sure the left (resp. right) corner of the popup is visible when in LTR (resp. RTL) (bug 1995579)
This commit is contained in:
parent
a6934b478f
commit
cb36dc28a7
@ -1234,8 +1234,8 @@ class CommentPopup {
|
||||
if (!correctPosition) {
|
||||
this.#editor.commentPopupPosition = [x, y];
|
||||
} else {
|
||||
const widthRatio =
|
||||
this._popupWidth / this.#editor.parentBoundingClientRect.width;
|
||||
const parentRect = this.#editor.parentBoundingClientRect;
|
||||
const widthRatio = this._popupWidth / parentRect.width;
|
||||
if (
|
||||
(this.#isLTR && x + widthRatio > 1) ||
|
||||
(!this.#isLTR && x - widthRatio >= 0)
|
||||
@ -1243,6 +1243,17 @@ class CommentPopup {
|
||||
const buttonWidth = this.#editor.commentButtonWidth;
|
||||
x -= widthRatio - buttonWidth;
|
||||
}
|
||||
const margin = 0.01;
|
||||
if (this.#isLTR) {
|
||||
x = Math.max(x, -parentRect.x / parentRect.width + margin);
|
||||
} else {
|
||||
x = Math.min(
|
||||
x,
|
||||
(window.innerWidth - parentRect.x) / parentRect.width -
|
||||
widthRatio -
|
||||
margin
|
||||
);
|
||||
}
|
||||
}
|
||||
this.#posX = x;
|
||||
this.#posY = y;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user