Skip to content

Commit e480fd2

Browse files
author
淘小杰
committed
add dragging className
add dragging className
1 parent 8203da3 commit e480fd2

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/draggable.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
/** @jsx React.DOM */
44
var React = require('react/addons');
55
var emptyFunction = require('react/lib/emptyFunction');
6+
var CX = React.addons.classSet;
67

78
function createUIEvent(draggable) {
89
return {
@@ -434,12 +435,16 @@ module.exports = React.createClass({
434435
if (this.state.dragging && !isNaN(this.props.zIndex)) {
435436
style.zIndex = this.props.zIndex;
436437
}
437-
438+
439+
var className = CX({
440+
'react-draggable': true,
441+
'react-dragging': this.state.dragging
442+
});
438443
// Reuse the child provided
439444
// This makes it flexible to use whatever element is wanted (div, ul, etc)
440445
return React.addons.cloneWithProps(React.Children.only(this.props.children), {
441446
style: style,
442-
className: 'react-draggable',
447+
className: className,
443448

444449
onMouseDown: this.handleDragStart,
445450
onTouchStart: function(ev){

0 commit comments

Comments
 (0)