Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

supercharged-slider

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supercharged-slider - npm Package Compare versions

Comparing version 0.2.4 to 0.2.5

19

dist/index.js

@@ -184,3 +184,2 @@ var index = "";

let isDragging = false;
let lastPositionBeforeMove = 0;
let lastCursorPosition = 0;

@@ -200,3 +199,3 @@ let lastWrapperPosition = 0;

lastCursorPosition = mousePosition;
lastWrapperPosition = Math.min(newPosition, threshold);
lastWrapperPosition = Math.max(Math.min(newPosition, threshold), 0);
slider.scrollWrapperTo(lastWrapperPosition);

@@ -209,3 +208,2 @@ };

isDragging = true;
lastPositionBeforeMove = slider.wrapperPosition;
slider.wrapper.style.transitionDuration = "0ms";

@@ -218,14 +216,5 @@ document.addEventListener("mousemove", onMouseMove);

const rectKey = isVertical() ? "slideHeight" : "slideWidth";
const threshold = (slider[rectKey] || 0) / 4;
const difference = lastPositionBeforeMove - lastWrapperPosition;
const movedRight = difference < 0;
const passedThreshold = Math.abs(difference) > threshold;
if (passedThreshold) {
if (movedRight)
slider.next();
else
slider.prev();
} else {
slider.scrollWrapperTo(lastPositionBeforeMove);
}
console.log(lastWrapperPosition);
const newIndex = Math.round(lastWrapperPosition / (slider[rectKey] || 0));
slider.slideTo(newIndex);
lastCursorPosition = 0;

@@ -232,0 +221,0 @@ isDragging = false;

{
"name": "supercharged-slider",
"version": "0.2.4",
"version": "0.2.5",
"description": "A super modular tiny slider library.",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -11,3 +11,2 @@ import { Middleware } from '~/types';

let lastPositionBeforeMove = 0;
let lastCursorPosition = 0;

@@ -31,3 +30,3 @@ let lastWrapperPosition = 0;

lastCursorPosition = mousePosition;
lastWrapperPosition = Math.min(newPosition, threshold);
lastWrapperPosition = Math.max(Math.min(newPosition, threshold), 0);

@@ -42,3 +41,2 @@ slider.scrollWrapperTo(lastWrapperPosition);

isDragging = true;
lastPositionBeforeMove = slider.wrapperPosition;

@@ -53,13 +51,6 @@ slider.wrapper.style.transitionDuration = '0ms';

const threshold = (slider[rectKey] || 0) / 4;
const difference = lastPositionBeforeMove - lastWrapperPosition;
const movedRight = difference < 0;
const passedThreshold = Math.abs(difference) > threshold;
console.log(lastWrapperPosition);
const newIndex = Math.round(lastWrapperPosition / (slider[rectKey] || 0));
if (passedThreshold) {
if (movedRight) slider.next();
else slider.prev();
} else {
slider.scrollWrapperTo(lastPositionBeforeMove);
}
slider.slideTo(newIndex);

@@ -66,0 +57,0 @@ lastCursorPosition = 0;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc