| Server IP : 185.208.173.17 / Your IP : 87.236.161.98 Web Server : Microsoft-IIS/10.0 System : Windows NT SRV8576125506 10.0 build 26100 (Windows Server 2016) AMD64 User : IUSR ( 0) PHP Version : 7.4.13 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/inetpub/wwwroot/parsmega.nuxt/node_modules/vue-waypoint/src/ |
Upload File : |
const GOING_IN = 'in'
const GOING_OUT = 'out'
const going = isIntersecting => isIntersecting ? GOING_IN : GOING_OUT
const DIRECTION_TOP = 'top'
const DIRECTION_RIGHT = 'right'
const DIRECTION_BOTTOM = 'bottom'
const DIRECTION_LEFT = 'left'
const direction = (boundingClientRect, oldBoundingClientRect) => {
if (boundingClientRect.top < oldBoundingClientRect.top) return DIRECTION_TOP
if (boundingClientRect.left > oldBoundingClientRect.left) return DIRECTION_RIGHT
if (boundingClientRect.top > oldBoundingClientRect.top) return DIRECTION_BOTTOM
if (boundingClientRect.left < oldBoundingClientRect.left) return DIRECTION_LEFT
}
const extractWaypointData = node => node._waypointData
const extractOldBoundingClientRect = (node, defaultBoundingClientRect) => {
const nodeData = extractWaypointData(node)
return typeof nodeData !== 'undefined' ? nodeData : defaultBoundingClientRect
}
const mapEntry = entry => {
const { boundingClientRect, isIntersecting, target } = entry
const oldBoundingClientRect = extractOldBoundingClientRect(target, boundingClientRect)
// save current rect
target._waypointData = boundingClientRect
return {
el: target,
going: going(isIntersecting),
direction: direction(boundingClientRect, oldBoundingClientRect),
_entry: entry
}
}
export {
going,
GOING_IN,
GOING_OUT,
direction,
DIRECTION_TOP,
DIRECTION_RIGHT,
DIRECTION_BOTTOM,
DIRECTION_LEFT,
mapEntry
}