Code cleanup con CodeMaid
This commit is contained in:
@@ -3,20 +3,20 @@ import getScroll from './getScroll';
|
||||
import getClientRect from './getClientRect';
|
||||
|
||||
export default function getViewportOffsetRectRelativeToArtbitraryNode(element, excludeScroll = false) {
|
||||
const html = element.ownerDocument.documentElement;
|
||||
const relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
|
||||
const width = Math.max(html.clientWidth, window.innerWidth || 0);
|
||||
const height = Math.max(html.clientHeight, window.innerHeight || 0);
|
||||
const html = element.ownerDocument.documentElement;
|
||||
const relativeOffset = getOffsetRectRelativeToArbitraryNode(element, html);
|
||||
const width = Math.max(html.clientWidth, window.innerWidth || 0);
|
||||
const height = Math.max(html.clientHeight, window.innerHeight || 0);
|
||||
|
||||
const scrollTop = !excludeScroll ? getScroll(html) : 0;
|
||||
const scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
|
||||
const scrollTop = !excludeScroll ? getScroll(html) : 0;
|
||||
const scrollLeft = !excludeScroll ? getScroll(html, 'left') : 0;
|
||||
|
||||
const offset = {
|
||||
top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
|
||||
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
|
||||
width,
|
||||
height,
|
||||
};
|
||||
const offset = {
|
||||
top: scrollTop - relativeOffset.top + relativeOffset.marginTop,
|
||||
left: scrollLeft - relativeOffset.left + relativeOffset.marginLeft,
|
||||
width,
|
||||
height,
|
||||
};
|
||||
|
||||
return getClientRect(offset);
|
||||
}
|
||||
return getClientRect(offset);
|
||||
}
|
||||
Reference in New Issue
Block a user