pull/6454/merge
tugcekucukoglu 2025-01-13 10:08:41 +03:00
parent b47856b65b
commit 8c570cac8c
1 changed files with 9 additions and 4 deletions

View File

@ -249,6 +249,11 @@ const Tooltip = BaseTooltip.extend('tooltip', {
getTooltipElement(el) { getTooltipElement(el) {
return document.getElementById(el.$_ptooltipId); return document.getElementById(el.$_ptooltipId);
}, },
getArrowElement(el) {
let tooltipElement = this.getTooltipElement(el);
return findSingle(tooltipElement, '[data-pc-section="arrow"]');
},
create(el) { create(el) {
const modifiers = el.$_ptooltipModifiers; const modifiers = el.$_ptooltipModifiers;
@ -383,7 +388,7 @@ const Tooltip = BaseTooltip.extend('tooltip', {
alignRight(el) { alignRight(el) {
this.preAlign(el, 'right'); this.preAlign(el, 'right');
let tooltipElement = this.getTooltipElement(el); let tooltipElement = this.getTooltipElement(el);
let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); let arrowElement = this.getArrowElement(el);
let hostOffset = this.getHostOffset(el); let hostOffset = this.getHostOffset(el);
let left = hostOffset.left + getOuterWidth(el); let left = hostOffset.left + getOuterWidth(el);
let top = hostOffset.top + (getOuterHeight(el) - getOuterHeight(tooltipElement)) / 2; let top = hostOffset.top + (getOuterHeight(el) - getOuterHeight(tooltipElement)) / 2;
@ -399,7 +404,7 @@ const Tooltip = BaseTooltip.extend('tooltip', {
alignLeft(el) { alignLeft(el) {
this.preAlign(el, 'left'); this.preAlign(el, 'left');
let tooltipElement = this.getTooltipElement(el); let tooltipElement = this.getTooltipElement(el);
let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); let arrowElement = this.getArrowElement(el);
let hostOffset = this.getHostOffset(el); let hostOffset = this.getHostOffset(el);
let left = hostOffset.left - getOuterWidth(tooltipElement); let left = hostOffset.left - getOuterWidth(tooltipElement);
let top = hostOffset.top + (getOuterHeight(el) - getOuterHeight(tooltipElement)) / 2; let top = hostOffset.top + (getOuterHeight(el) - getOuterHeight(tooltipElement)) / 2;
@ -415,7 +420,7 @@ const Tooltip = BaseTooltip.extend('tooltip', {
alignTop(el) { alignTop(el) {
this.preAlign(el, 'top'); this.preAlign(el, 'top');
let tooltipElement = this.getTooltipElement(el); let tooltipElement = this.getTooltipElement(el);
let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); let arrowElement = this.getArrowElement(el);
let tooltipWidth = getOuterWidth(tooltipElement); let tooltipWidth = getOuterWidth(tooltipElement);
let elementWidth = getOuterWidth(el); let elementWidth = getOuterWidth(el);
let { width: viewportWidth } = getViewport(); let { width: viewportWidth } = getViewport();
@ -446,7 +451,7 @@ const Tooltip = BaseTooltip.extend('tooltip', {
alignBottom(el) { alignBottom(el) {
this.preAlign(el, 'bottom'); this.preAlign(el, 'bottom');
let tooltipElement = this.getTooltipElement(el); let tooltipElement = this.getTooltipElement(el);
let arrowElement = findSingle(tooltipElement, '[data-pc-section="arrow"]'); let arrowElement = this.getArrowElement(el);
let tooltipWidth = getOuterWidth(tooltipElement); let tooltipWidth = getOuterWidth(tooltipElement);
let elementWidth = getOuterWidth(el); let elementWidth = getOuterWidth(el);
let { width: viewportWidth } = getViewport(); let { width: viewportWidth } = getViewport();