Merge branch 'dev' of https://gitea.verdnatura.es/verdnatura/salix into dev
gitea/salix/dev This commit looks good
Details
gitea/salix/dev This commit looks good
Details
This commit is contained in:
commit
a577218f5d
|
@ -118,6 +118,7 @@ export default class Popover extends Component {
|
|||
*/
|
||||
relocate() {
|
||||
if (!(this.parent && this._shown)) return;
|
||||
let margin = 10;
|
||||
|
||||
let style = this.popover.style;
|
||||
style.width = '';
|
||||
|
@ -136,9 +137,8 @@ export default class Popover extends Component {
|
|||
let height = popoverRect.height;
|
||||
let width = Math.max(popoverRect.width, parentRect.width);
|
||||
let top = parentRect.top + parentRect.height + arrowHeight;
|
||||
let left = parentRect.left + parentRect.width / 2 - width / 2;
|
||||
let left = Math.max(parentRect.left + parentRect.width / 2 - width / 2, margin);
|
||||
|
||||
let margin = 10;
|
||||
let showTop = top + height + margin > window.innerHeight;
|
||||
|
||||
if (showTop)
|
||||
|
@ -151,7 +151,10 @@ export default class Popover extends Component {
|
|||
else
|
||||
arrowStyle.top = `0`;
|
||||
|
||||
arrowStyle.left = `${(parentRect.left - left) + parentRect.width / 2}px`;
|
||||
let arrowMargin = margin + 10;
|
||||
let arrowLeft = (parentRect.left - left) + parentRect.width / 2;
|
||||
arrowLeft = Math.max(Math.min(arrowLeft, width - arrowMargin), arrowMargin);
|
||||
arrowStyle.left = `${arrowLeft}px`;
|
||||
|
||||
style.top = `${top}px`;
|
||||
style.left = `${left}px`;
|
||||
|
|
Loading…
Reference in New Issue