mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
fix: typos (#40899)
This commit is contained in:
parent
fd0d8b6031
commit
433a73c53b
@ -165,15 +165,15 @@ class InternalAffix extends React.Component<InternalAffixProps, AffixState> {
|
||||
status: AffixStatus.None,
|
||||
};
|
||||
const targetRect = getTargetRect(targetNode);
|
||||
const placeholderReact = getTargetRect(this.placeholderNodeRef.current);
|
||||
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);
|
||||
const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom);
|
||||
const placeholderRect = getTargetRect(this.placeholderNodeRef.current);
|
||||
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop);
|
||||
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
|
||||
|
||||
if (
|
||||
placeholderReact.top === 0 &&
|
||||
placeholderReact.left === 0 &&
|
||||
placeholderReact.width === 0 &&
|
||||
placeholderReact.height === 0
|
||||
placeholderRect.top === 0 &&
|
||||
placeholderRect.left === 0 &&
|
||||
placeholderRect.width === 0 &&
|
||||
placeholderRect.height === 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
@ -182,23 +182,23 @@ class InternalAffix extends React.Component<InternalAffixProps, AffixState> {
|
||||
newState.affixStyle = {
|
||||
position: 'fixed',
|
||||
top: fixedTop,
|
||||
width: placeholderReact.width,
|
||||
height: placeholderReact.height,
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height,
|
||||
};
|
||||
newState.placeholderStyle = {
|
||||
width: placeholderReact.width,
|
||||
height: placeholderReact.height,
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height,
|
||||
};
|
||||
} else if (fixedBottom !== undefined) {
|
||||
newState.affixStyle = {
|
||||
position: 'fixed',
|
||||
bottom: fixedBottom,
|
||||
width: placeholderReact.width,
|
||||
height: placeholderReact.height,
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height,
|
||||
};
|
||||
newState.placeholderStyle = {
|
||||
width: placeholderReact.width,
|
||||
height: placeholderReact.height,
|
||||
width: placeholderRect.width,
|
||||
height: placeholderRect.height,
|
||||
};
|
||||
}
|
||||
|
||||
@ -241,9 +241,9 @@ class InternalAffix extends React.Component<InternalAffixProps, AffixState> {
|
||||
const targetNode = targetFunc();
|
||||
if (targetNode && this.placeholderNodeRef.current) {
|
||||
const targetRect = getTargetRect(targetNode);
|
||||
const placeholderReact = getTargetRect(this.placeholderNodeRef.current);
|
||||
const fixedTop = getFixedTop(placeholderReact, targetRect, offsetTop);
|
||||
const fixedBottom = getFixedBottom(placeholderReact, targetRect, offsetBottom);
|
||||
const placeholderRect = getTargetRect(this.placeholderNodeRef.current);
|
||||
const fixedTop = getFixedTop(placeholderRect, targetRect, offsetTop);
|
||||
const fixedBottom = getFixedBottom(placeholderRect, targetRect, offsetBottom);
|
||||
|
||||
if (
|
||||
(fixedTop !== undefined && affixStyle.top === fixedTop) ||
|
||||
|
@ -9,19 +9,19 @@ export function getTargetRect(target: BindElement): DOMRect {
|
||||
: ({ top: 0, bottom: window.innerHeight } as DOMRect);
|
||||
}
|
||||
|
||||
export function getFixedTop(placeholderReact: DOMRect, targetRect: DOMRect, offsetTop?: number) {
|
||||
if (offsetTop !== undefined && targetRect.top > placeholderReact.top - offsetTop) {
|
||||
export function getFixedTop(placeholderRect: DOMRect, targetRect: DOMRect, offsetTop?: number) {
|
||||
if (offsetTop !== undefined && targetRect.top > placeholderRect.top - offsetTop) {
|
||||
return offsetTop + targetRect.top;
|
||||
}
|
||||
return undefined;
|
||||
}
|
||||
|
||||
export function getFixedBottom(
|
||||
placeholderReact: DOMRect,
|
||||
placeholderRect: DOMRect,
|
||||
targetRect: DOMRect,
|
||||
offsetBottom?: number,
|
||||
) {
|
||||
if (offsetBottom !== undefined && targetRect.bottom < placeholderReact.bottom + offsetBottom) {
|
||||
if (offsetBottom !== undefined && targetRect.bottom < placeholderRect.bottom + offsetBottom) {
|
||||
const targetBottomOffset = window.innerHeight - targetRect.bottom;
|
||||
return offsetBottom + targetBottomOffset;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user