File tree 1 file changed +26
-4
lines changed
1 file changed +26
-4
lines changed Original file line number Diff line number Diff line change @@ -497,10 +497,32 @@ export class Rnd extends React.Component<Props, State> {
497
497
const { left, top } = this . getOffsetFromParent ( ) ;
498
498
let draggablePosition ;
499
499
if ( position ) {
500
- draggablePosition = {
501
- x : position . x - left ,
502
- y : position . y - top ,
503
- } ;
500
+ switch ( dragAxis ) {
501
+ case "x" :
502
+ draggablePosition = {
503
+ x : position . x - left ,
504
+ y : position . y ,
505
+ } ;
506
+ break ;
507
+ case "y" :
508
+ draggablePosition = {
509
+ x : position . x ,
510
+ y : position . y - top ,
511
+ } ;
512
+ break ;
513
+ case "none" :
514
+ draggablePosition = {
515
+ x : position . x ,
516
+ y : position . y ,
517
+ } ;
518
+ break ;
519
+ default :
520
+ draggablePosition = {
521
+ x : position . x - left ,
522
+ y : position . y - top ,
523
+ } ;
524
+ break ;
525
+ }
504
526
}
505
527
return (
506
528
< Draggable
You can’t perform that action at this time.
0 commit comments