famous-carousel
Advanced tools
Comparing version 0.9.13 to 0.9.14
@@ -54,3 +54,3 @@ "use strict"; | ||
this.currentIndex = options.initialIndex || 0; | ||
this.threshold = 0.3; | ||
this.threshold = 0.45; | ||
this.pageWidth = 0; | ||
@@ -228,2 +228,3 @@ | ||
var gestureHandler = new _GestureHandler2.default(slide); | ||
var anchorXoffset; | ||
/*eslint-disable */ | ||
@@ -234,20 +235,47 @@ gestureHandler.on("drag", (function (index, e) { | ||
this.draggedIndex = index; | ||
anchorXoffset = 0; | ||
return; | ||
case "move": | ||
if (this.draggedIndex !== index) { | ||
return; | ||
if (this.draggedIndex === index) { | ||
var visibleSlides = this.adjacentSlides(index); | ||
for (var key in visibleSlides) { | ||
var idx = visibleSlides[key]; | ||
if (isNaN(idx)) { | ||
continue; | ||
} | ||
anchorXoffset = e.centerDelta.x / this.pages[idx].node.getSize()[0]; | ||
anchorXoffset += this.pages[idx].anchor.x; | ||
this.pages[idx].anchor.set(anchorXoffset, 0, 0); | ||
} | ||
} | ||
break; | ||
return; | ||
case "end": | ||
// Snap anchor back to center on release | ||
if (this.draggedIndex === index) { | ||
if (this.pages[index].anchor.x !== 0) { | ||
this.pages[index].anchor.set(0, 0, 0); | ||
var direction = 0; | ||
if (anchorXoffset >= this.threshold) { | ||
direction = -1; // left | ||
} else if (anchorXoffset <= -this.threshold) { | ||
direction = 1; // right | ||
} | ||
if (direction === 0) { | ||
// Snap anchor back to center on release | ||
var visibleSlides = this.adjacentSlides(index); | ||
if (!isNaN(visibleSlides.left)) { | ||
this.pages[visibleSlides.left].anchor.set(-1, 0, 0); | ||
if (this.pages[index].anchor.x !== 0) { | ||
this.pages[index].anchor.set(0, 0, 0); | ||
if (!isNaN(visibleSlides.left)) { | ||
this.pages[visibleSlides.left].anchor.set(-1, 0, 0); | ||
} | ||
if (!isNaN(visibleSlides.right)) { | ||
this.pages[visibleSlides.right].anchor.set(1, 0, 0); | ||
} | ||
} | ||
if (!isNaN(visibleSlides.right)) { | ||
this.pages[visibleSlides.right].anchor.set(1, 0, 0); | ||
} | ||
} else { | ||
// Fire page change event if slide has moved beyond threshold | ||
this.options.context.emit("pageChange", { | ||
direction: direction, | ||
numSlidesToAdvance: this.options.manualSlidesToAdvance, | ||
stopAutoPlay: true | ||
}); | ||
} | ||
@@ -260,33 +288,2 @@ } | ||
} | ||
var visibleSlides = this.adjacentSlides(index); | ||
var anchorXoffset; | ||
for (var key in visibleSlides) { | ||
var idx = visibleSlides[key]; | ||
if (isNaN(idx)) { | ||
continue; | ||
} | ||
anchorXoffset = e.centerDelta.x / this.pages[idx].node.getSize()[0]; | ||
anchorXoffset += this.pages[idx].anchor.x; | ||
this.pages[idx].anchor.set(anchorXoffset, 0, 0); | ||
} | ||
// Fire page change event if slide has moved beyond threshold | ||
var direction = 0; | ||
if (this.draggedIndex === index && this.currentIndex === index) { | ||
if (anchorXoffset >= this.threshold) { | ||
direction = -1; // left | ||
} | ||
if (anchorXoffset <= -this.threshold) { | ||
direction = 1; // right | ||
} | ||
} | ||
if (direction !== 0) { | ||
this.draggedIndex = -1; | ||
this.options.context.emit("pageChange", { | ||
direction: direction, | ||
numSlidesToAdvance: this.options.manualSlidesToAdvance, | ||
stopAutoPlay: true | ||
}); | ||
} | ||
}).bind(this, i)); | ||
@@ -314,3 +311,3 @@ /*eslint-enable */ | ||
var spring = new Spring(null, box, { | ||
period: 0.3, | ||
period: 0.4, | ||
dampingRatio: 0.7, | ||
@@ -317,0 +314,0 @@ anchor: anchor |
{ | ||
"name": "famous-carousel", | ||
"version": "0.9.13", | ||
"version": "0.9.14", | ||
"author": "Peace Chen", | ||
@@ -5,0 +5,0 @@ "contributors": ["Tony Alves (https://github.com/talves)"], |
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
445222
29
2992
3
4
5