[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) {
|
if (!correctPosition) {
|
||||||
this.#editor.commentPopupPosition = [x, y];
|
this.#editor.commentPopupPosition = [x, y];
|
||||||
} else {
|
} else {
|
||||||
const widthRatio =
|
const parentRect = this.#editor.parentBoundingClientRect;
|
||||||
this._popupWidth / this.#editor.parentBoundingClientRect.width;
|
const widthRatio = this._popupWidth / parentRect.width;
|
||||||
if (
|
if (
|
||||||
(this.#isLTR && x + widthRatio > 1) ||
|
(this.#isLTR && x + widthRatio > 1) ||
|
||||||
(!this.#isLTR && x - widthRatio >= 0)
|
(!this.#isLTR && x - widthRatio >= 0)
|
||||||
@ -1243,6 +1243,17 @@ class CommentPopup {
|
|||||||
const buttonWidth = this.#editor.commentButtonWidth;
|
const buttonWidth = this.#editor.commentButtonWidth;
|
||||||
x -= widthRatio - buttonWidth;
|
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.#posX = x;
|
||||||
this.#posY = y;
|
this.#posY = y;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user