react-light-marquee
Advanced tools
Comparing version 0.1.10 to 0.1.11
@@ -51,31 +51,18 @@ // src/Marquee/index.tsx | ||
}; | ||
var getDistanceBetweenEdges = (direction, startRect, endRect) => { | ||
let distance = startRect.bottom - endRect.top; | ||
if (direction === "left") distance = endRect.right - startRect.left; | ||
else if (direction === "right") distance = startRect.right - endRect.left; | ||
else if (direction === "up") distance = endRect.bottom - startRect.top; | ||
return distance; | ||
}; | ||
var getContentSize = (children, direction) => { | ||
const firstChildRect = children[0].getBoundingClientRect(); | ||
const lastChildRect = children[children.length - 1].getBoundingClientRect(); | ||
if (!firstChildRect || !lastChildRect) return 0; | ||
if (direction === "left") { | ||
return lastChildRect.right - firstChildRect.left; | ||
} | ||
if (direction === "right") { | ||
return firstChildRect.right - lastChildRect.left; | ||
} | ||
if (direction === "up") { | ||
return lastChildRect.bottom - firstChildRect.top; | ||
} | ||
return firstChildRect.bottom - lastChildRect.top; | ||
return getDistanceBetweenEdges(direction, firstChildRect, lastChildRect); | ||
}; | ||
var getSlideEndingEdge = (node, direction) => { | ||
const parentRect = node.parentNode?.getBoundingClientRect(); | ||
if (!parentRect) return 0; | ||
const slideRect = node.getBoundingClientRect(); | ||
if (direction === "left") { | ||
return slideRect.right - parentRect.left; | ||
} | ||
if (direction === "right") { | ||
return parentRect.right - slideRect.left; | ||
} | ||
if (direction === "up") { | ||
return slideRect.bottom - parentRect.top; | ||
} | ||
return parentRect.bottom - slideRect.top; | ||
var getSlideEndingEdge = (parentElement, slideElement, direction) => { | ||
const parentRect = parentElement.getBoundingClientRect(); | ||
const slideRect = slideElement.getBoundingClientRect(); | ||
return getDistanceBetweenEdges(direction, parentRect, slideRect); | ||
}; | ||
@@ -95,3 +82,3 @@ var getNodeSize = (node, direction) => { | ||
childElements.forEach((slide) => { | ||
slideEdges.push(getSlideEndingEdge(slide, direction)); | ||
slideEdges.push(getSlideEndingEdge(wrapper, slide, direction)); | ||
needsReplication || (needsReplication = contentSize - getNodeSize(slide, direction) < wrapperSize); | ||
@@ -98,0 +85,0 @@ }); |
{ | ||
"name": "react-light-marquee", | ||
"version": "0.1.10", | ||
"version": "0.1.11", | ||
"private": false, | ||
@@ -5,0 +5,0 @@ "type": "module", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
47729
454