embla-carousel
Advanced tools
Comparing version 2.3.1 to 2.3.2
export declare type Vector1D = { | ||
get: () => number; | ||
set: (v2: Vector1D) => Vector1D; | ||
add: (v2: Vector1D) => Vector1D; | ||
subtract: (v2: Vector1D) => Vector1D; | ||
set: (v: Vector1D) => Vector1D; | ||
add: (v: Vector1D) => Vector1D; | ||
subtract: (v: Vector1D) => Vector1D; | ||
multiply: (n: number) => Vector1D; | ||
@@ -7,0 +7,0 @@ setNumber: (n: number) => Vector1D; |
@@ -109,3 +109,3 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
function Vector1D(value) { | ||
var vector = { | ||
var state = { | ||
value: value | ||
@@ -115,17 +115,17 @@ }; | ||
function get() { | ||
return vector.value; | ||
return state.value; | ||
} | ||
function set(v2) { | ||
vector.value = v2.get(); | ||
function set(v) { | ||
state.value = v.get(); | ||
return self; | ||
} | ||
function add(v2) { | ||
vector.value += v2.get(); | ||
function add(v) { | ||
state.value += v.get(); | ||
return self; | ||
} | ||
function subtract(v2) { | ||
vector.value -= v2.get(); | ||
function subtract(v) { | ||
state.value -= v.get(); | ||
return self; | ||
@@ -135,3 +135,3 @@ } | ||
function multiply(n) { | ||
vector.value *= n; | ||
state.value *= n; | ||
return self; | ||
@@ -141,3 +141,3 @@ } | ||
function divide(n) { | ||
vector.value /= n; | ||
state.value /= n; | ||
return self; | ||
@@ -147,3 +147,3 @@ } | ||
function setNumber(n) { | ||
vector.value = n; | ||
state.value = n; | ||
return self; | ||
@@ -153,3 +153,3 @@ } | ||
function addNumber(n) { | ||
vector.value += n; | ||
state.value += n; | ||
return self; | ||
@@ -159,3 +159,3 @@ } | ||
function subtractNumber(n) { | ||
vector.value -= n; | ||
state.value -= n; | ||
return self; | ||
@@ -293,3 +293,3 @@ } | ||
function EventStore() { | ||
var event = { | ||
var state = { | ||
listeners: [] | ||
@@ -301,3 +301,3 @@ }; | ||
node.addEventListener(type, handler, options); | ||
event.listeners.push(function () { | ||
state.listeners.push(function () { | ||
return node.removeEventListener(type, handler, options); | ||
@@ -309,3 +309,3 @@ }); | ||
function removeAll() { | ||
event.listeners.filter(function (remove) { | ||
state.listeners.filter(function (remove) { | ||
return remove(); | ||
@@ -1569,3 +1569,3 @@ }); | ||
var trackInterval = 10; | ||
var pointer = { | ||
var state = { | ||
isMouse: false, | ||
@@ -1577,3 +1577,3 @@ trackPoints: [], | ||
function read(evt, axis) { | ||
var isMouse = pointer.isMouse; | ||
var isMouse = state.isMouse; | ||
var c = coords[axis]; | ||
@@ -1585,3 +1585,3 @@ var value = isMouse ? evt[c] : evt.touches[0][c]; | ||
function down(evt) { | ||
pointer.isMouse = !!evt.type.match(/mouse/); | ||
state.isMouse = !!evt.type.match(/mouse/); | ||
var point = read(evt, 'x'); | ||
@@ -1596,7 +1596,7 @@ startDrag.set(point); | ||
var time2 = new Date().getTime(); | ||
var time1 = pointer.trackTime; | ||
var time1 = state.trackTime; | ||
if (time2 - time1 >= trackInterval) { | ||
pointer.trackPoints.push(point.get()); | ||
pointer.trackTime = time2; | ||
state.trackPoints.push(point.get()); | ||
state.trackTime = time2; | ||
} | ||
@@ -1612,4 +1612,4 @@ | ||
var currentPoint = lastDrag.get(); | ||
var trackLength = pointer.isMouse ? 5 : 4; | ||
lastDrag.setNumber(pointer.trackPoints.slice(-trackLength).map(function (point) { | ||
var trackLength = state.isMouse ? 5 : 4; | ||
lastDrag.setNumber(state.trackPoints.slice(-trackLength).map(function (point) { | ||
return currentPoint - point; | ||
@@ -1619,3 +1619,3 @@ }).sort(function (p1, p2) { | ||
})[0] || 0); | ||
pointer.trackPoints = []; | ||
state.trackPoints = []; | ||
return size.measure(lastDrag.get()); | ||
@@ -1622,0 +1622,0 @@ } |
{ | ||
"name": "embla-carousel", | ||
"version": "2.3.1", | ||
"version": "2.3.2", | ||
"author": "David Cetinkaya", | ||
@@ -5,0 +5,0 @@ "private": false, |
75964