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

react-dnd-touch-backend

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-dnd-touch-backend - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

.travis.yml

31

dist/Touch.js

@@ -19,4 +19,2 @@ /**

var _reactDndModulesUtilsOffsetHelpers = require('react-dnd/modules/utils/OffsetHelpers');
var _invariant = require('invariant');

@@ -26,2 +24,25 @@

function getEventClientOffset(e) {
return {
x: e.clientX,
y: e.clientY
};
}
var ELEMENT_NODE = 1;
function getNodeClientOffset(node) {
var el = node.nodeType === ELEMENT_NODE ? node : node.parentElement;
if (!el) {
return null;
}
var _el$getBoundingClientRect = el.getBoundingClientRect();
var top = _el$getBoundingClientRect.top;
var left = _el$getBoundingClientRect.left;
return { x: left, y: top };
}
var TouchBackend = (function () {

@@ -124,3 +145,3 @@ function TouchBackend(manager) {

value: function getSourceClientOffset(sourceId) {
return (0, _reactDndModulesUtilsOffsetHelpers.getElementClientOffset)(this.sourceNodes[sourceId]);
return getNodeClientOffset(this.sourceNodes[sourceId]);
}

@@ -149,3 +170,3 @@ }, {

this._mouseClientOffset = (0, _reactDndModulesUtilsOffsetHelpers.getEventClientOffset)(e.targetTouches[0]);
this._mouseClientOffset = getEventClientOffset(e.targetTouches[0]);
}

@@ -163,3 +184,3 @@ }, {

var clientOffset = (0, _reactDndModulesUtilsOffsetHelpers.getEventClientOffset)(e.targetTouches[0]);
var clientOffset = getEventClientOffset(e.targetTouches[0]);

@@ -166,0 +187,0 @@ // If we're not dragging and we've moved a little, that counts as a drag start

4

package.json
{
"name": "react-dnd-touch-backend",
"version": "0.1.0",
"version": "0.1.1",
"description": "Touch backend for react-dnd",

@@ -8,3 +8,3 @@ "main": "dist/Touch.js",

"prepublish": "gulp dist",
"test": "gulp lint"
"test": "gulp clean lint"
},

@@ -11,0 +11,0 @@ "repository": {

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

<img src="https://avatars2.githubusercontent.com/u/6412038?v=3&s=200" alt="react logo" title="react" align="right" width="64" height="64" />
# react-dnd-touch-backend
[![npm version](https://badge.fury.io/js/react-dnd-touch-backend.svg)](http://badge.fury.io/js/react-dnd-touch-backend)
[![Dependency Status](https://david-dm.org/yahoo/react-dnd-touch-backend.svg)](https://david-dm.org/yahoo/react-dnd-touch-backend)
[![devDependency Status](https://david-dm.org/yahoo/react-dnd-touch-backend/dev-status.svg)](https://david-dm.org/yahoo/react-dnd-touch-backend#info=devDependencies)
Touch Backend for [react-dnd](https://github.com/gaearon/react-dnd)

@@ -3,0 +10,0 @@

@@ -7,5 +7,25 @@ /**

import { getElementClientOffset, getEventClientOffset } from 'react-dnd/modules/utils/OffsetHelpers';
import invariant from 'invariant';
function getEventClientOffset (e) {
return {
x: e.clientX,
y: e.clientY
};
}
const ELEMENT_NODE = 1;
function getNodeClientOffset (node) {
const el = node.nodeType === ELEMENT_NODE
? node
: node.parentElement;
if (!el) {
return null;
}
const { top, left } = el.getBoundingClientRect();
return { x: left, y: top };
}
export class TouchBackend {

@@ -93,3 +113,3 @@ constructor (manager) {

getSourceClientOffset (sourceId) {
return getElementClientOffset(this.sourceNodes[sourceId]);
return getNodeClientOffset(this.sourceNodes[sourceId]);
}

@@ -96,0 +116,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