embla-carousel
Advanced tools
Comparing version 0.7.8 to 0.8.0
@@ -7,3 +7,2 @@ import { Counter } from './counter'; | ||
dragFree: boolean; | ||
location: Vector1D; | ||
index: Counter; | ||
@@ -23,5 +22,5 @@ loop: boolean; | ||
byIndex: (target: number, direction: number) => Target; | ||
byDistance: (from: number, distance: number) => Target; | ||
byDistance: (force: number) => Target; | ||
}; | ||
export declare function TargetFinder(params: Params): TargetFinder; | ||
export {}; |
@@ -18,5 +18,5 @@ import { Animation } from './animation'; | ||
toIndex: (target: number) => Traveller; | ||
toDistance: (from: number, force: number) => Traveller; | ||
toDistance: (force: number) => Traveller; | ||
}; | ||
export declare function Traveller(params: Params): Traveller; | ||
export {}; |
@@ -670,5 +670,6 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
var update = function update() { | ||
slider.mover.seek(target).update(); | ||
if (!pointer.isDown()) { | ||
if (!loop) slider.edgeGuard.constrain(target); | ||
slider.mover.seek(target).update(); | ||
@@ -713,3 +714,2 @@ if (slider.mover.settle(target)) { | ||
limit: limit, | ||
location: location, | ||
loop: loop, | ||
@@ -1052,3 +1052,3 @@ span: contentSize, | ||
function minAllowedForce(force) { | ||
function allowedForce(force) { | ||
var groupSizes = params.groupSizes, | ||
@@ -1065,8 +1065,13 @@ index = params.index; | ||
function down(evt) { | ||
var node = evt.target; | ||
state.isMouse = !!evt.type.match(/mouse/); | ||
var target = params.target, | ||
mover = params.mover; | ||
var evtTarget = evt.target, | ||
type = evt.type; | ||
state.isMouse = !!type.match(/mouse/); | ||
pointer.down(evt); | ||
locationAtDragStart.set(location); | ||
target.set(location); | ||
state.preventClick = false; | ||
state.isDown = true; | ||
mover.useSpeed(50); | ||
animation.start(); | ||
@@ -1079,3 +1084,3 @@ addInteractionEvents(); | ||
startY.set(pointer.read(evt, 'y')); | ||
} else if (!isFocusNode(node)) { | ||
} else if (!isFocusNode(evtTarget)) { | ||
evt.preventDefault(); | ||
@@ -1088,7 +1093,8 @@ } | ||
var limit = params.limit, | ||
loop = params.loop; | ||
loop = params.loop, | ||
target = params.target; | ||
var diff = pointer.move(evt); | ||
var reachedAnyLimit = limit.reachedAny(location.get()); | ||
var resist = !loop && reachedAnyLimit ? 2 : 1; | ||
location.addNumber(diff / resist); | ||
target.addNumber(diff / resist); | ||
evt.preventDefault(); | ||
@@ -1110,4 +1116,8 @@ } else { | ||
var boostedForce = pointer.up() * pointerForceBoost(); | ||
var force = minAllowedForce(boostedForce); | ||
var force = allowedForce(boostedForce); | ||
var speed = movementSpeed(); | ||
var diffToTarget = Math.abs(target.get() - location.get()); | ||
var minDiffToTarget = 1; | ||
var isMoving = diffToTarget <= minDiffToTarget; | ||
if (isMoving) state.preventClick = true; | ||
state.isMouse = false; | ||
@@ -1117,9 +1127,5 @@ state.preventScroll = false; | ||
interactionEvents.removeAll(); | ||
mover.useSpeed(speed); | ||
events.dispatch('dragEnd'); | ||
var diffToTarget = Math.abs(target.get() - location.get()); | ||
var minDiffToTarget = 1; | ||
if (diffToTarget <= minDiffToTarget) return; | ||
state.preventClick = true; | ||
mover.useSpeed(speed); | ||
travel.toDistance(locationAtDragStart.get(), force); | ||
travel.toDistance(force); | ||
} | ||
@@ -1604,4 +1610,3 @@ | ||
function TargetFinder(params) { | ||
var location = params.location, | ||
loop = params.loop, | ||
var loop = params.loop, | ||
groupPositions = params.groupPositions, | ||
@@ -1699,3 +1704,3 @@ span = params.span; | ||
function byDistance(from, force) { | ||
function byDistance(force) { | ||
var target = params.target, | ||
@@ -1707,4 +1712,3 @@ dragFree = params.dragFree, | ||
reachedMax = limit.reachedMax; | ||
var targetDistance = location.get() + force; | ||
var freeDistance = targetDistance - from; | ||
var targetDistance = target.get() + force; | ||
var targetGroup = findTargetGroupAt(targetDistance); | ||
@@ -1719,3 +1723,3 @@ var reachedEdge = !loop && reachedAny(targetDistance); | ||
return { | ||
distance: freeDistance, | ||
distance: force, | ||
index: targetIndex | ||
@@ -1828,4 +1832,4 @@ }; | ||
function toDistance(from, force) { | ||
var next = findTarget.byDistance(from, force); | ||
function toDistance(force) { | ||
var next = findTarget.byDistance(force); | ||
travelTo(next); | ||
@@ -1832,0 +1836,0 @@ return self; |
{ | ||
"name": "embla-carousel", | ||
"version": "0.7.8", | ||
"version": "0.8.0", | ||
"author": "David Cetinkaya", | ||
@@ -5,0 +5,0 @@ "private": false, |
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
1927
66423