mirror of
https://github.com/shoelace-style/shoelace.git
synced 2026-01-12 02:59:13 +00:00
fix conflict
This commit is contained in:
@@ -510,13 +510,19 @@ export default class SlCarousel extends ShoelaceElement {
|
|||||||
// It's best to assume that we will and cleanup in the else case below if we didn't need to
|
// It's best to assume that we will and cleanup in the else case below if we didn't need to
|
||||||
this.pendingSlideChange = true;
|
this.pendingSlideChange = true;
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
|
// This can happen if goToSlide is called before the scroll container is rendered
|
||||||
|
// We will have correctly set the activeSlide in goToSlide which will get picked up when initializeSlides is called.
|
||||||
|
if (!this.scrollContainer) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const scrollContainer = this.scrollContainer;
|
const scrollContainer = this.scrollContainer;
|
||||||
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
const scrollContainerRect = scrollContainer.getBoundingClientRect();
|
||||||
const nextSlideRect = slide.getBoundingClientRect();
|
const nextSlideRect = slide.getBoundingClientRect();
|
||||||
|
|
||||||
const nextLeft = nextSlideRect.left - scrollContainerRect.left;
|
const nextLeft = nextSlideRect.left - scrollContainerRect.left;
|
||||||
const nextTop = nextSlideRect.top - scrollContainerRect.top;
|
const nextTop = nextSlideRect.top - scrollContainerRect.top;
|
||||||
|
|
||||||
if (nextLeft || nextTop) {
|
if (nextLeft || nextTop) {
|
||||||
// This is here just in case someone set it back to false
|
// This is here just in case someone set it back to false
|
||||||
// between rAF being requested and the callback actually running
|
// between rAF being requested and the callback actually running
|
||||||
|
|||||||
Reference in New Issue
Block a user