UEA-PRODEM
This commit is contained in:
+23
-19
@@ -174,7 +174,7 @@ function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
||||
if (getNodeName(offsetParent) !== 'body' || isOverflowElement(documentElement)) {
|
||||
scroll = getNodeScroll(offsetParent);
|
||||
}
|
||||
if (isHTMLElement(offsetParent)) {
|
||||
if (isOffsetParentAnElement) {
|
||||
const offsetRect = getBoundingClientRect(offsetParent);
|
||||
scale = getScale(offsetParent);
|
||||
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
||||
@@ -262,7 +262,6 @@ function getViewportRect(element, strategy) {
|
||||
};
|
||||
}
|
||||
|
||||
const absoluteOrFixed = /*#__PURE__*/new Set(['absolute', 'fixed']);
|
||||
// Returns the inner client rect, subtracting scrollbars if present.
|
||||
function getInnerBoundingClientRect(element, strategy) {
|
||||
const clientRect = getBoundingClientRect(element, true, strategy === 'fixed');
|
||||
@@ -327,7 +326,7 @@ function getClippingElementAncestors(element, cache) {
|
||||
if (!currentNodeIsContaining && computedStyle.position === 'fixed') {
|
||||
currentContainingBlockComputedStyle = null;
|
||||
}
|
||||
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && absoluteOrFixed.has(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
||||
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === 'static' && !!currentContainingBlockComputedStyle && (currentContainingBlockComputedStyle.position === 'absolute' || currentContainingBlockComputedStyle.position === 'fixed') || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
||||
if (shouldDropCurrentNode) {
|
||||
// Drop non-containing blocks.
|
||||
result = result.filter(ancestor => ancestor !== currentNode);
|
||||
@@ -352,20 +351,23 @@ function getClippingRect(_ref) {
|
||||
} = _ref;
|
||||
const elementClippingAncestors = boundary === 'clippingAncestors' ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
||||
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
||||
const firstClippingAncestor = clippingAncestors[0];
|
||||
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
||||
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
||||
accRect.top = max(rect.top, accRect.top);
|
||||
accRect.right = min(rect.right, accRect.right);
|
||||
accRect.bottom = min(rect.bottom, accRect.bottom);
|
||||
accRect.left = max(rect.left, accRect.left);
|
||||
return accRect;
|
||||
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
||||
const firstRect = getClientRectFromClippingAncestor(element, clippingAncestors[0], strategy);
|
||||
let top = firstRect.top;
|
||||
let right = firstRect.right;
|
||||
let bottom = firstRect.bottom;
|
||||
let left = firstRect.left;
|
||||
for (let i = 1; i < clippingAncestors.length; i++) {
|
||||
const rect = getClientRectFromClippingAncestor(element, clippingAncestors[i], strategy);
|
||||
top = max(rect.top, top);
|
||||
right = min(rect.right, right);
|
||||
bottom = min(rect.bottom, bottom);
|
||||
left = max(rect.left, left);
|
||||
}
|
||||
return {
|
||||
width: clippingRect.right - clippingRect.left,
|
||||
height: clippingRect.bottom - clippingRect.top,
|
||||
x: clippingRect.left,
|
||||
y: clippingRect.top
|
||||
width: right - left,
|
||||
height: bottom - top,
|
||||
x: left,
|
||||
y: top
|
||||
};
|
||||
}
|
||||
|
||||
@@ -616,7 +618,7 @@ function autoUpdate(reference, floating, update, options) {
|
||||
animationFrame = false
|
||||
} = options;
|
||||
const referenceEl = unwrapElement(reference);
|
||||
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...getOverflowAncestors(floating)] : [];
|
||||
const ancestors = ancestorScroll || ancestorResize ? [...(referenceEl ? getOverflowAncestors(referenceEl) : []), ...(floating ? getOverflowAncestors(floating) : [])] : [];
|
||||
ancestors.forEach(ancestor => {
|
||||
ancestorScroll && ancestor.addEventListener('scroll', update, {
|
||||
passive: true
|
||||
@@ -629,7 +631,7 @@ function autoUpdate(reference, floating, update, options) {
|
||||
if (elementResize) {
|
||||
resizeObserver = new ResizeObserver(_ref => {
|
||||
let [firstEntry] = _ref;
|
||||
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
||||
if (firstEntry && firstEntry.target === referenceEl && resizeObserver && floating) {
|
||||
// Prevent update loops when using the `size` middleware.
|
||||
// https://github.com/floating-ui/floating-ui/issues/1740
|
||||
resizeObserver.unobserve(floating);
|
||||
@@ -644,7 +646,9 @@ function autoUpdate(reference, floating, update, options) {
|
||||
if (referenceEl && !animationFrame) {
|
||||
resizeObserver.observe(referenceEl);
|
||||
}
|
||||
resizeObserver.observe(floating);
|
||||
if (floating) {
|
||||
resizeObserver.observe(floating);
|
||||
}
|
||||
}
|
||||
let frameId;
|
||||
let prevRefRect = animationFrame ? getBoundingClientRect(reference) : null;
|
||||
|
||||
Reference in New Issue
Block a user