embla-carousel-vue
Advanced tools
Comparing version 8.0.0-rc01 to 8.0.0-rc02
@@ -146,3 +146,3 @@ (function (global, factory) { | ||
} | ||
function Animation(callback) { | ||
function Animation(update, draw) { | ||
const documentVisibleHandler = EventStore(); | ||
@@ -153,3 +153,5 @@ const timeStep = 1000 / 60; | ||
let animationFrame = 0; | ||
function init() { | ||
let engine; | ||
function init(engineInstance) { | ||
engine = engineInstance; | ||
documentVisibleHandler.add(document, 'visibilitychange', () => { | ||
@@ -176,5 +178,6 @@ if (document.hidden) lastTimeStamp = null; | ||
while (delta >= timeStep) { | ||
callback(); | ||
update(engine); | ||
delta -= timeStep; | ||
} | ||
draw(engine); | ||
if (animationFrame) start(); | ||
@@ -582,2 +585,3 @@ } | ||
attractionDirection = mathSign(attraction.get() || diff); | ||
return self; | ||
} | ||
@@ -1142,10 +1146,18 @@ function settle(target) { | ||
const slideIndexes = arrayKeys(slides); | ||
// Draw | ||
const animationCallback = () => { | ||
const pointerDown = engine.dragHandler.pointerDown(); | ||
if (!loop) engine.scrollBounds.constrain(pointerDown); | ||
engine.scrollBody.seek(target); | ||
const settled = engine.scrollBody.settle(target); | ||
// Animation | ||
function update({ | ||
target, | ||
dragHandler, | ||
scrollBody, | ||
scrollBounds, | ||
scrollLooper, | ||
slideLooper, | ||
eventHandler, | ||
animation | ||
}) { | ||
const pointerDown = dragHandler.pointerDown(); | ||
if (!loop) scrollBounds.constrain(pointerDown); | ||
const settled = scrollBody.seek(target).settle(target); | ||
if (settled && !pointerDown) { | ||
engine.animation.stop(); | ||
animation.stop(); | ||
eventHandler.emit('settle'); | ||
@@ -1157,10 +1169,15 @@ } | ||
if (loop) { | ||
engine.scrollLooper.loop(engine.scrollBody.direction()); | ||
engine.slideLooper.loop(); | ||
scrollLooper.loop(scrollBody.direction()); | ||
slideLooper.loop(); | ||
} | ||
engine.translate.to(location); | ||
}; | ||
} | ||
function draw({ | ||
translate, | ||
location | ||
}) { | ||
translate.to(location); | ||
} | ||
// Shared | ||
const friction = 0.68; | ||
const animation = Animation(animationCallback); | ||
const animation = Animation(update, draw); | ||
const startLocation = scrollSnaps[index.get()]; | ||
@@ -1175,2 +1192,3 @@ const location = Vector1D(startLocation); | ||
const engine = { | ||
eventHandler, | ||
containerRect, | ||
@@ -1342,4 +1360,4 @@ slideRects, | ||
}) => options)]).forEach(query => mediaHandlers.add(query, 'change', reActivate)); | ||
engine.animation.init(); | ||
eventHandler.init(self); | ||
engine.animation.init(engine); | ||
engine.eventHandler.init(self); | ||
engine.resizeHandler.init(self, options.watchResize); | ||
@@ -1346,0 +1364,0 @@ engine.slidesHandler.init(self, options.watchSlides); |
{ | ||
"name": "embla-carousel-vue", | ||
"version": "8.0.0-rc01", | ||
"version": "8.0.0-rc02", | ||
"author": "David Jerleke", | ||
@@ -59,4 +59,4 @@ "description": "A lightweight carousel library with fluid motion and great swipe precision", | ||
"dependencies": { | ||
"embla-carousel": "8.0.0-rc01", | ||
"embla-carousel-reactive-utils": "8.0.0-rc01" | ||
"embla-carousel": "8.0.0-rc02", | ||
"embla-carousel-reactive-utils": "8.0.0-rc02" | ||
}, | ||
@@ -63,0 +63,0 @@ "peerDependencies": { |
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
56092
1617
0
+ Addedembla-carousel@8.0.0-rc02(transitive)
+ Addedembla-carousel-reactive-utils@8.0.0-rc02(transitive)
- Removedembla-carousel@8.0.0-rc01(transitive)
- Removedembla-carousel-reactive-utils@8.0.0-rc01(transitive)
Updatedembla-carousel@8.0.0-rc02