![Maven Central Adds Sigstore Signature Validation](https://cdn.sanity.io/images/cgdhsj6q/production/7da3bc8a946cfb5df15d7fcf49767faedc72b483-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Maven Central Adds Sigstore Signature Validation
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
react-draggable2
Advanced tools
React draggable component
Based on https://github.com/mzabriskie/react-draggable
$ npm install react-draggable2
http://mzabriskie.github.io/react-draggable/example/
/** @jsx React.DOM */
var React = require('react'),
Draggable = require('react-draggable');
var App = React.createClass({
handleStart: function (event, ui) {
console.log('Event: ', event);
console.log('Position: ', ui.position);
},
handleDrag: function (event, ui) {
console.log('Event: ', event);
console.log('Position: ', ui.position);
},
handleStop: function (event, ui) {
console.log('Event: ', event);
console.log('Position: ', ui.position);
},
render: function () {
return (
// <Draggable/> transparently adds draggable interactivity
// to whatever element is supplied as `this.props.children`.
// Only a single element is allowed or an Error will be thrown.
//
// `axis` determines which axis the draggable can move.
// - 'both' allows movement horizontally and vertically (default).
// - 'x' limits movement to horizontal axis.
// - 'y' limits movement to vertical axis.
//
// `handle` specifies a selector to be used as the handle that initiates drag.
//
// `cancel` specifies a selector to be used to prevent drag initialization.
//
// `bound` determines whether to bound the movement to the parent box.
// - 'top' bounds movement to the top edge of the parent box.
// - 'right' bounds movement to the right edge of the parent box.
// - 'bottom' bounds movement to the bottom edge of the parent box.
// - 'left' bounds movement to the left edge of the parent box.
// - 'all' bounds movement to all edges (default if not specified).
// - 'point' to constrain only the top-left corner.
// - 'box' to constrain the entire box (default if not specified).
//
// `constrain` takes a function to constrain the dragging.
//
// `start` specifies the x and y that the dragged item should start at
//
// `zIndex` specifies the zIndex to use while dragging.
//
// `onStart` is called when dragging starts.
//
// `onDrag` is called while dragging.
//
// `onStop` is called when dragging stops.
<Draggable
axis="x"
handle=".handle"
grid={constrain(25)}
start={{x: 25, y: 25}}
bound="all box"
zIndex={100}
onStart={this.handleStart}
onDrag={this.handleDrag}
onStop={this.handleStop}>
<div>
<div className="handle">Drag from here</div>
<div>Lorem ipsum...</div>
</div>
</Draggable>
);
}
});
function constrain (snap) {
function constrainOffset (offset, prev) {
var delta = offset - prev;
if (Math.abs(delta) >= snap) {
return prev + parseInt(delta / snap, 10) * snap;
}
return prev;
}
return function (pos) {
return {
top: constrainOffset(pos.top, pos.prevTop),
left: constrainOffset(pos.left, pos.prevLeft)
};
};
}
React.renderComponent(<App/>, document.body);
$ npm install && npm start
$ npm test
MIT
0.4.1 (Dec 7, 2014)
FAQs
React draggable component
The npm package react-draggable2 receives a total of 61 weekly downloads. As such, react-draggable2 popularity was classified as not popular.
We found that react-draggable2 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.