@@ -203,7 +203,7 @@ var Draggable = /*#__PURE__*/function (_React$Component) {
203203 y = _this$props$position . y ;
204204 newState . x = x ;
205205 newState . y = y ;
206- } else {
206+ } else if ( _this . props . returnToDefaultPosition ) {
207207 var _this$props$defaultPo = _this . props . defaultPosition ,
208208 _x = _this$props$defaultPo . x ,
209209 _y = _this$props$defaultPo . y ;
@@ -265,6 +265,7 @@ var Draggable = /*#__PURE__*/function (_React$Component) {
265265 var _this$props = this . props ,
266266 axis = _this$props . axis ,
267267 bounds = _this$props . bounds ,
268+ returnToDefaultPosition = _this$props . returnToDefaultPosition ,
268269 children = _this$props . children ,
269270 defaultPosition = _this$props . defaultPosition ,
270271 defaultClassName = _this$props . defaultClassName ,
@@ -273,7 +274,7 @@ var Draggable = /*#__PURE__*/function (_React$Component) {
273274 position = _this$props . position ,
274275 positionOffset = _this$props . positionOffset ,
275276 scale = _this$props . scale ,
276- draggableCoreProps = _objectWithoutProperties ( _this$props , [ "axis" , "bounds" , "children" , "defaultPosition" , "defaultClassName" , "defaultClassNameDragging" , "defaultClassNameDragged" , "position" , "positionOffset" , "scale" ] ) ;
277+ draggableCoreProps = _objectWithoutProperties ( _this$props , [ "axis" , "bounds" , "returnToDefaultPosition" , " children", "defaultPosition" , "defaultClassName" , "defaultClassNameDragging" , "defaultClassNameDragged" , "position" , "positionOffset" , "scale" ] ) ;
277278
278279 var style = { } ;
279280 var svgTransform = null ; // If this is controlled, we don't want to move it - unless it's dragging.
@@ -369,6 +370,11 @@ _defineProperty(Draggable, "propTypes", _objectSpread({}, _DraggableCore.default
369370 top : _propTypes . default . number ,
370371 bottom : _propTypes . default . number
371372 } ) , _propTypes . default . string , _propTypes . default . oneOf ( [ false ] ) ] ) ,
373+
374+ /**
375+ * `returnToDefaultPosition` Determines if element returns to start position when drag ends.
376+ */
377+ returnToDefaultPosition : _propTypes . default . bool ,
372378 defaultClassName : _propTypes . default . string ,
373379 defaultClassNameDragging : _propTypes . default . string ,
374380 defaultClassNameDragged : _propTypes . default . string ,
@@ -435,6 +441,8 @@ _defineProperty(Draggable, "propTypes", _objectSpread({}, _DraggableCore.default
435441_defineProperty ( Draggable , "defaultProps" , _objectSpread ( { } , _DraggableCore . default . defaultProps , {
436442 axis : 'both' ,
437443 bounds : false ,
444+ returnToDefaultPosition : false ,
445+ dragContainer : null ,
438446 defaultClassName : 'react-draggable' ,
439447 defaultClassNameDragging : 'react-draggable-dragging' ,
440448 defaultClassNameDragged : 'react-draggable-dragged' ,
0 commit comments