Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
alexreardon committed May 17, 2018
1 parent bb28a9d commit ad6ef18
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 8 deletions.
53 changes: 53 additions & 0 deletions src/state/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -453,19 +453,72 @@ export default (state: State = idle, action: Action): State => {
});
}

if (action.type === 'MOVE_UP' || action.type === 'MOVE_DOWN' || action.type === 'MOVE_LEFT' || action.type === 'MOVE_RIGHT') {
// Not doing keyboard movements during these phases
if (state.phase === 'BULK_COLLECTING' || state.phase === 'DROP_PENDING') {
return state;
}

invariant(state.phase === 'DRAGGING', `${action.type} received while not in DRAGGING phase`);

// 1. what droppable are you over?
// *. if over no droppable, allow cross axis moves from the home droppable.
// * otherwise just ignore the move
// 2. what is the axis of the droppable?
// 3. is the action a main axis or cross axis move?
// 4. is the action forwards or backwards?


if (isMovingOnMainAxis) {

}




// It is possible to lift a draggable in a disabled droppable
// In which case it will not have a destination
if (!state.impact.destination) {
return state;
}

}

if (action.type === 'MOVE_FORWARD' || action.type === 'MOVE_BACKWARD') {
if (state.phase === 'BULK_COLLECTING' || state.phase === 'DROP_PENDING') {
return state;
}

invariant(state.phase === 'DRAGGING', `${action.type} received while not in DRAGGING phase`);


// Allowing cross axis movement from a disabled droppable
if (!state.impact.destination) {
const home: DroppableDimension = state.dimensions.droppables[state.critical.droppable.id];

if (home.axis === vertical) {

}

if (home.axis === horizontal) {

}

return state;
}


// It is possible to lift a draggable in a disabled droppable
// In which case it will not have a destination
if (!state.impact.destination) {
return state;
}

const isOver: DroppableDimension = state.dimensions.droppables[state.impact.destination.droppableId];
const direction: Direction = isOver.axis.direction;

if(direction === 'vertical')

const isMovingForward: boolean = action.type === 'MOVE_FORWARD';

const droppable: DroppableDimension = state.dimensions.droppables[
Expand Down
16 changes: 8 additions & 8 deletions src/view/draggable/connected-draggable.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import getDisplacementMap, { type DisplacementMap } from '../../state/get-displa
import {
lift as liftAction,
move as moveAction,
moveForward as moveForwardAction,
moveBackward as moveBackwardAction,
crossAxisMoveForward as crossAxisMoveForwardAction,
crossAxisMoveBackward as crossAxisMoveBackwardAction,
moveUp as moveUpAction,
moveDown as moveDownAction,
moveLeft as moveLeftAction,
moveRight as moveRightAction,
drop as dropAction,
dropAnimationFinished as dropAnimationFinishedAction,
moveByWindowScroll as moveByWindowScrollAction,
Expand Down Expand Up @@ -213,10 +213,10 @@ export const makeMapStateToProps = (): Selector => {
const mapDispatchToProps: DispatchProps = {
lift: liftAction,
move: moveAction,
moveForward: moveForwardAction,
moveBackward: moveBackwardAction,
crossAxisMoveForward: crossAxisMoveForwardAction,
crossAxisMoveBackward: crossAxisMoveBackwardAction,
moveUp: moveUpAction,
moveDown: moveDownAction,
moveLeft: moveLeftAction,
moveRight: moveRightAction,
moveByWindowScroll: moveByWindowScrollAction,
drop: dropAction,
dropAnimationFinished: dropAnimationFinishedAction,
Expand Down

0 comments on commit ad6ef18

Please sign in to comment.