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

@nrk/core-scroll

Package Overview
Dependencies
Maintainers
92
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nrk/core-scroll - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

24

core-scroll.cjs.js
'use strict';
var name = "@nrk/core-scroll";
var version = "1.1.9";
var version = "1.2.0";

@@ -115,2 +115,3 @@ var IS_BROWSER = typeof window !== 'undefined';

var MOVE = {up: {y: -1, prop: 'top'}, down: {y: 1, prop: 'bottom'}, left: {x: -1}, right: {x: 1}};
var SIGNIFICANT_DRAG_THRESHOLD = 10;
var FRICTION = 0.8;

@@ -163,2 +164,4 @@ var VELOCITY = 20;

DRAG.pageY = event.pageY;
DRAG.diffSumX = 0;
DRAG.diffSumY = 0;
DRAG.scrollX = el.scrollLeft;

@@ -177,8 +180,25 @@ DRAG.scrollY = el.scrollTop;

/**
* Check that the current drag is significant.
*
* When the user clicks on an element and the cursor moves slightly, it is most
* likely that the user wanted to click in stead of drag.
*/
function isSignificantDrag () {
return (
Math.abs(DRAG.diffSumX) > SIGNIFICANT_DRAG_THRESHOLD ||
Math.abs(DRAG.diffSumY) > SIGNIFICANT_DRAG_THRESHOLD
)
}
function onMousemove (event) {
DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX);
DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY);
DRAG.diffSumX += DRAG.diffX;
DRAG.diffSumY += DRAG.diffY;
DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX;
DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY;
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
if (isSignificantDrag()) {
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
}
}

@@ -185,0 +205,0 @@

@@ -8,2 +8,3 @@ import {name, version} from './package.json'

const MOVE = {up: {y: -1, prop: 'top'}, down: {y: 1, prop: 'bottom'}, left: {x: -1}, right: {x: 1}}
const SIGNIFICANT_DRAG_THRESHOLD = 10
const FRICTION = 0.8

@@ -54,2 +55,4 @@ const VELOCITY = 20

DRAG.pageY = event.pageY
DRAG.diffSumX = 0
DRAG.diffSumY = 0
DRAG.scrollX = el.scrollLeft

@@ -68,8 +71,25 @@ DRAG.scrollY = el.scrollTop

/**
* Check that the current drag is significant.
*
* When the user clicks on an element and the cursor moves slightly, it is most
* likely that the user wanted to click in stead of drag.
*/
function isSignificantDrag () {
return (
Math.abs(DRAG.diffSumX) > SIGNIFICANT_DRAG_THRESHOLD ||
Math.abs(DRAG.diffSumY) > SIGNIFICANT_DRAG_THRESHOLD
)
}
function onMousemove (event) {
DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX)
DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY)
DRAG.diffSumX += DRAG.diffX
DRAG.diffSumY += DRAG.diffY
DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX
DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY
DRAG.target.style.pointerEvents = 'none' // Prevent links when we know there has been movement
if (isSignificantDrag()) {
DRAG.target.style.pointerEvents = 'none' // Prevent links when we know there has been movement
}
}

@@ -76,0 +96,0 @@

@@ -1,2 +0,2 @@

/*! @nrk/core-scroll v1.1.9 - Copyright (c) 2017-2018 NRK */
/*! @nrk/core-scroll v1.2.0 - Copyright (c) 2017-2018 NRK */
(function (global, factory) {

@@ -12,3 +12,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('react'), require('prop-types')) :

var name = "@nrk/core-scroll";
var version = "1.1.9";
var version = "1.2.0";

@@ -139,2 +139,3 @@ var IS_BROWSER = typeof window !== 'undefined';

var MOVE = {up: {y: -1, prop: 'top'}, down: {y: 1, prop: 'bottom'}, left: {x: -1}, right: {x: 1}};
var SIGNIFICANT_DRAG_THRESHOLD = 10;
var FRICTION = 0.8;

@@ -187,2 +188,4 @@ var VELOCITY = 20;

DRAG.pageY = event.pageY;
DRAG.diffSumX = 0;
DRAG.diffSumY = 0;
DRAG.scrollX = el.scrollLeft;

@@ -201,8 +204,25 @@ DRAG.scrollY = el.scrollTop;

/**
* Check that the current drag is significant.
*
* When the user clicks on an element and the cursor moves slightly, it is most
* likely that the user wanted to click in stead of drag.
*/
function isSignificantDrag () {
return (
Math.abs(DRAG.diffSumX) > SIGNIFICANT_DRAG_THRESHOLD ||
Math.abs(DRAG.diffSumY) > SIGNIFICANT_DRAG_THRESHOLD
)
}
function onMousemove (event) {
DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX);
DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY);
DRAG.diffSumX += DRAG.diffX;
DRAG.diffSumY += DRAG.diffY;
DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX;
DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY;
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
if (isSignificantDrag()) {
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
}
}

@@ -209,0 +229,0 @@

@@ -1,2 +0,2 @@

/*! @nrk/core-scroll v1.1.9 - Copyright (c) 2017-2018 NRK */
/*! @nrk/core-scroll v1.2.0 - Copyright (c) 2017-2018 NRK */
(function (global, factory) {

@@ -9,3 +9,3 @@ typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :

var name = "@nrk/core-scroll";
var version = "1.1.9";
var version = "1.2.0";

@@ -121,2 +121,3 @@ var IS_BROWSER = typeof window !== 'undefined';

var MOVE = {up: {y: -1, prop: 'top'}, down: {y: 1, prop: 'bottom'}, left: {x: -1}, right: {x: 1}};
var SIGNIFICANT_DRAG_THRESHOLD = 10;
var FRICTION = 0.8;

@@ -169,2 +170,4 @@ var VELOCITY = 20;

DRAG.pageY = event.pageY;
DRAG.diffSumX = 0;
DRAG.diffSumY = 0;
DRAG.scrollX = el.scrollLeft;

@@ -183,8 +186,25 @@ DRAG.scrollY = el.scrollTop;

/**
* Check that the current drag is significant.
*
* When the user clicks on an element and the cursor moves slightly, it is most
* likely that the user wanted to click in stead of drag.
*/
function isSignificantDrag () {
return (
Math.abs(DRAG.diffSumX) > SIGNIFICANT_DRAG_THRESHOLD ||
Math.abs(DRAG.diffSumY) > SIGNIFICANT_DRAG_THRESHOLD
)
}
function onMousemove (event) {
DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX);
DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY);
DRAG.diffSumX += DRAG.diffX;
DRAG.diffSumY += DRAG.diffY;
DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX;
DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY;
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
if (isSignificantDrag()) {
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
}
}

@@ -191,0 +211,0 @@

@@ -9,3 +9,3 @@ 'use strict';

var name = "@nrk/core-scroll";
var version = "1.1.9";
var version = "1.2.0";

@@ -136,2 +136,3 @@ var IS_BROWSER = typeof window !== 'undefined';

var MOVE = {up: {y: -1, prop: 'top'}, down: {y: 1, prop: 'bottom'}, left: {x: -1}, right: {x: 1}};
var SIGNIFICANT_DRAG_THRESHOLD = 10;
var FRICTION = 0.8;

@@ -184,2 +185,4 @@ var VELOCITY = 20;

DRAG.pageY = event.pageY;
DRAG.diffSumX = 0;
DRAG.diffSumY = 0;
DRAG.scrollX = el.scrollLeft;

@@ -198,8 +201,25 @@ DRAG.scrollY = el.scrollTop;

/**
* Check that the current drag is significant.
*
* When the user clicks on an element and the cursor moves slightly, it is most
* likely that the user wanted to click in stead of drag.
*/
function isSignificantDrag () {
return (
Math.abs(DRAG.diffSumX) > SIGNIFICANT_DRAG_THRESHOLD ||
Math.abs(DRAG.diffSumY) > SIGNIFICANT_DRAG_THRESHOLD
)
}
function onMousemove (event) {
DRAG.diffX = DRAG.pageX - (DRAG.pageX = event.pageX);
DRAG.diffY = DRAG.pageY - (DRAG.pageY = event.pageY);
DRAG.diffSumX += DRAG.diffX;
DRAG.diffSumY += DRAG.diffY;
DRAG.target.scrollLeft = DRAG.scrollX += DRAG.diffX;
DRAG.target.scrollTop = DRAG.scrollY += DRAG.diffY;
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
if (isSignificantDrag()) {
DRAG.target.style.pointerEvents = 'none'; // Prevent links when we know there has been movement
}
}

@@ -206,0 +226,0 @@

2

package.json

@@ -5,3 +5,3 @@ {

"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)",
"version": "1.2.0",
"version": "1.2.1",
"license": "MIT",

@@ -8,0 +8,0 @@ "main": "core-scroll.cjs.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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