Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving between lists #73

Merged
merged 135 commits into from
Sep 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
135 commits
Select commit Hold shift + click to select a range
c3cdb8f
add story for dragging between two vertical lists
jaredcrowe Aug 25, 2017
cb38e79
add story for dragging between two vertical lists (#58)
jaredcrowe Aug 25, 2017
ce9f997
work in progress (#59)
alexreardon Aug 25, 2017
1f9640c
more progress (#60)
alexreardon Aug 25, 2017
ceee569
wip
alexreardon Aug 27, 2017
32d2e62
action creator plumbing
alexreardon Aug 27, 2017
ee6a4de
more refinement
alexreardon Aug 27, 2017
4ca11ac
adding complexity to stories
alexreardon Aug 27, 2017
545a9ae
WIP
jaredcrowe Aug 28, 2017
8a01ec6
Merge branch 'multiple-vertical-lists' into moving-between-lists
jaredcrowe Aug 28, 2017
27e6694
improving get-best-cross-axis-droppable
alexreardon Aug 28, 2017
61ec7ee
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
jaredcrowe Aug 28, 2017
095e23e
almost moving to the right place
alexreardon Aug 28, 2017
9b4e414
hacking something together
alexreardon Aug 28, 2017
53cbf60
initial placeholder
alexreardon Aug 28, 2017
6b21ff2
implement mouse dragging between lists, fix tests.
jaredcrowe Aug 28, 2017
f6c4139
Merge branches 'moving-between-lists' and 'moving-between-lists' of g…
jaredcrowe Aug 28, 2017
b1dd265
fixes
alexreardon Aug 28, 2017
a2dd115
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
alexreardon Aug 28, 2017
1fd2fdb
adding scroll container
alexreardon Aug 28, 2017
5fcbc7f
wip
alexreardon Aug 28, 2017
0bf8c23
fixing performance issue when moving to a new droppable
alexreardon Aug 28, 2017
e2d2c23
adding explaination and tests for optional patch value
alexreardon Aug 28, 2017
be3012c
re-write getNewHomeClientOffset and fix tests
jaredcrowe Aug 29, 2017
533cf5b
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
jaredcrowe Aug 29, 2017
1f00de0
wip
alexreardon Aug 29, 2017
28950dd
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
alexreardon Aug 29, 2017
b37f77b
fix drag impact when dragging between multiple lists with internal sc…
jaredcrowe Aug 29, 2017
fe2dc65
fix minor type error in action-creators
jaredcrowe Aug 29, 2017
fa47b64
move-to-edge
alexreardon Aug 29, 2017
4ce37d7
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
alexreardon Aug 29, 2017
e6ed7cd
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
jaredcrowe Aug 29, 2017
e91cbfe
making source a fragment
alexreardon Aug 29, 2017
ca9568d
better keyboard transitions
alexreardon Aug 29, 2017
9981831
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
jaredcrowe Aug 29, 2017
c8bff8b
getNewHomeClientOffset works for all multiple vertical cases. tidy fu…
jaredcrowe Aug 29, 2017
4d7bf24
wip
alexreardon Aug 29, 2017
cfac61d
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
alexreardon Aug 29, 2017
ac8f28f
wip tests
alexreardon Aug 29, 2017
dadafdb
Merge branch 'master' of github.com:atlassian/react-beautiful-dnd int…
alexreardon Aug 30, 2017
7628ea2
adding tests for move-to-edge
alexreardon Aug 30, 2017
b030294
refactor getNewHomeClientOffset tests to make life easier when adding…
jaredcrowe Aug 30, 2017
dca5858
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
jaredcrowe Aug 30, 2017
a1f0e4f
refactoring keyboard movement - wip
alexreardon Aug 31, 2017
8e2ab45
add tests for updated getNewHomeClientOffset function. add client dim…
jaredcrowe Sep 1, 2017
6128a35
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
alexreardon Sep 1, 2017
0e525a4
Merge branch 'master' of github.com:atlassian/react-beautiful-dnd int…
alexreardon Sep 1, 2017
dc485a3
wip
alexreardon Sep 4, 2017
18f1622
dragging with a keyboard now uses edges
alexreardon Sep 4, 2017
d267a78
minor enchancement to hooks integration test
alexreardon Sep 4, 2017
e8f5cd8
fixing jump to next index tests
alexreardon Sep 4, 2017
95c96ca
fixing remaining jump-to-next-index tests
alexreardon Sep 4, 2017
b63cd2a
spiking
alexreardon Sep 5, 2017
1631663
work in progress
alexreardon Sep 5, 2017
6d20289
it works
alexreardon Sep 5, 2017
7b779ae
wip
alexreardon Sep 5, 2017
fd05533
logging
alexreardon Sep 5, 2017
04c1ca8
seperating jump to index functions for my sanity
alexreardon Sep 5, 2017
910b229
removing unneeded property
alexreardon Sep 6, 2017
9a4ac81
working on re entering into home list after transition
alexreardon Sep 6, 2017
5fd90b2
wip
alexreardon Sep 6, 2017
c18b833
refactoring move-to-new-droppable
alexreardon Sep 6, 2017
0fdde59
returning to home list now working much better
alexreardon Sep 6, 2017
a146a0b
making the order of the moved array consistant between files
alexreardon Sep 6, 2017
3dead3d
updating stories
alexreardon Sep 6, 2017
a883716
fixing story
alexreardon Sep 6, 2017
beb995a
trying to get scroll working
alexreardon Sep 6, 2017
c7e19c5
more example data
alexreardon Sep 6, 2017
177d71e
now handling window scroll correctly for keyboard movements
alexreardon Sep 6, 2017
434abf5
fixing incorrect impact order when moving back to home list when movi…
alexreardon Sep 7, 2017
6f3cd06
adding isEnabled flag
alexreardon Sep 7, 2017
714be5b
Merge branch 'master' into moving-between-lists
alexreardon Sep 7, 2017
e218a0d
new client offset now works correctly for keyboard dragging
alexreardon Sep 7, 2017
7d6a2c8
fixing mouse movement
alexreardon Sep 7, 2017
b3b39a0
fixing existing jump to next tests
alexreardon Sep 7, 2017
8c0e972
improving tests
alexreardon Sep 7, 2017
5316f9c
jump to next index tests are looking good
alexreardon Sep 7, 2017
b9c5609
fixing broken get-drag-impact tests
alexreardon Sep 7, 2017
48f7c5a
starting work on get-best-droppable tests
alexreardon Sep 7, 2017
8af5a4e
renmaing jump to next to move to next
alexreardon Sep 7, 2017
c97a48c
removing temp type addition
alexreardon Sep 7, 2017
dae315e
adding tests for get-best-cross-axis-droppable
alexreardon Sep 8, 2017
4bd60f7
adding tests for get-closest-draggable
alexreardon Sep 8, 2017
1a09d3f
adding horizontal tests to get-closest-draggable
alexreardon Sep 8, 2017
3e13b31
Jaredcrowe/moving lists disabled droppables (#80)
jaredcrowe Sep 8, 2017
3fb9a5f
get-closest-draggable now uses a loop to check axis
alexreardon Sep 8, 2017
173fe78
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
alexreardon Sep 8, 2017
41e9ebc
get-closest-draggable now considers the droppables scroll
alexreardon Sep 8, 2017
c59e57b
container scroll now cancels a keyboard drag
alexreardon Sep 8, 2017
5f5243f
progress
alexreardon Sep 8, 2017
6a7a1cc
renaming move-to-best-droppable to move-cross-axis
alexreardon Sep 8, 2017
9389db5
adding tests
alexreardon Sep 8, 2017
e3fe56f
adding more test cases to fill in
alexreardon Sep 8, 2017
630d623
adding page visiblity checks
alexreardon Sep 10, 2017
76c59d5
now finding all options within a droppable
alexreardon Sep 10, 2017
0011793
correcting visiblity check for when inside a dimension
alexreardon Sep 11, 2017
0058fdc
disallowing container scroll while drag is occuring
alexreardon Sep 11, 2017
630564b
renaming allowScroll to isScrollAllowed
alexreardon Sep 11, 2017
88b5b39
add tests for dragging between lists to get-drag-impact.spec (#82)
jaredcrowe Sep 11, 2017
25a5401
adding some tests
alexreardon Sep 11, 2017
dfa4bbd
Merge branch 'moving-between-lists' of github.com:atlassian/react-bea…
alexreardon Sep 11, 2017
942307e
renaming create-droppable
alexreardon Sep 11, 2017
937c068
cleaning up types in test util
alexreardon Sep 11, 2017
372195b
tests for is-within-visible-bounds-of-droppable
alexreardon Sep 11, 2017
6070b18
tests for move-to-new-droppable
alexreardon Sep 11, 2017
932de9f
adding horizontal tests for move-to-new-droppable
alexreardon Sep 11, 2017
e349ba7
adding test for droppable dimension clipping
alexreardon Sep 12, 2017
0bff636
fixing flow errors in test file
alexreardon Sep 12, 2017
da5d620
adding child visibility check to move-cross-axis/index
alexreardon Sep 12, 2017
b6579c0
adding placeholder validation to connected droppable tests
alexreardon Sep 12, 2017
2165d79
cleaning up tests
alexreardon Sep 12, 2017
67b8895
adding tests for publishing whether a droppable is enabling during a …
alexreardon Sep 12, 2017
c15cae1
placeholder tests for unnconnected droppable
alexreardon Sep 12, 2017
e5a2d4f
adding cross axis move tests to drag handle
alexreardon Sep 12, 2017
c7a25ce
cross axis move tests for draggable
alexreardon Sep 12, 2017
95367ff
fixing flow errors
alexreardon Sep 12, 2017
18762e0
initial impact now handled independently
alexreardon Sep 12, 2017
e1a6fee
adding tests for impact for disabled droppables
alexreardon Sep 12, 2017
d54cf87
more robust dimension clipping
alexreardon Sep 12, 2017
0e96515
fixing flow errors. moving get-client-rect to src
alexreardon Sep 12, 2017
d46d330
adding tests for droppable dimension clipping
alexreardon Sep 13, 2017
6d535d6
rearranging to follow AAA
alexreardon Sep 13, 2017
dcd114f
major refactor of get-client-offset
alexreardon Sep 13, 2017
f21a629
fixing linting and flow
alexreardon Sep 13, 2017
3228ec2
reworking stories
alexreardon Sep 13, 2017
20c9d45
fixing stories
alexreardon Sep 13, 2017
c053acd
fixing keyboard drop into empty list
alexreardon Sep 14, 2017
78029bc
major story refactoring
alexreardon Sep 14, 2017
b114b1c
adding checks for padding
alexreardon Sep 14, 2017
cfbd43f
droppable dimension is now padding aware
alexreardon Sep 14, 2017
5d58b25
fixing import
alexreardon Sep 14, 2017
a580d3f
fixing flow issues
alexreardon Sep 14, 2017
1b7db06
Merge branch 'master' of github.com:atlassian/react-beautiful-dnd int…
alexreardon Sep 14, 2017
4c7b08b
updating docs
alexreardon Sep 14, 2017
aa5ecbe
more updates to readme
alexreardon Sep 14, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@
// All blocks must be wrapped in curly braces {}
// Preventing if(condition) return;
// https://eslint.org/docs/rules/curly
"curly": ["error", "all"]
"curly": ["error", "all"],

// Allowing Math.pow rather than forcing `**`
// https://eslint.org/docs/rules/no-restricted-properties
"no-restricted-properties": ["off", {
"object": "Math",
"property": "pow"
}]
}
}
57 changes: 45 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ class App extends Component {
)}
</Draggable>
))}
{provided.placeholder}
</div>
)}
</Droppable>
Expand Down Expand Up @@ -390,7 +391,7 @@ type DraggableLocation = {|

### Best practices for `hooks`

**Block updates during a drag**
#### Block updates during a drag

It is **highly** recommended that while a user is dragging that you block any state updates that might impact the amount of `Draggable`s and `Droppable`s, or their dimensions. Please listen to `onDragStart` and block updates to the `Draggable`s and `Droppable`s until you receive at `onDragEnd`.

Expand All @@ -404,12 +405,7 @@ Here are a few poor user experiences that can occur if you change things *during
- If you remove the node that the user is dragging the drag will instantly end
- If you change the dimension of the dragging node then other things will not move out of the way at the correct time.


**`onDragStart` and `onDragEnd` pairing**

We try very hard to ensure that each `onDragStart` event is paired with a single `onDragEnd` event. However, there maybe a rouge situation where this is not the case. If that occurs - it is a bug. Currently there is no mechanism to tell the library to cancel a current drag externally.

**Style**
#### Add a cursor style and block selection

During a drag it is recommended that you add two styles to the body:

Expand All @@ -420,9 +416,24 @@ During a drag it is recommended that you add two styles to the body:

`cursor: [your desired cursor];` is needed because we apply `pointer-events: none;` to the dragging item. This prevents you setting your own cursor style on the Draggable directly based on `snapshot.isDragging` (see `Draggable`).

#### Force focus after a transition between lists

When an item is moved from one list to a different list it looses browser focus if it had it. This is because `React` creates a new node in this situation. It will not loose focus if transitioned within the same list. The dragging item will always have had browser focus if it is dragging with a keyboard. It is highly recommended that you give the item (which is now in a different list) focus again. You can see an example of how to do this in our stories. Here is an example of how you could do it:

- `onDragEnd`: move the item into the new list and record the id fo the item that has moved
- When rendering the reordered list pass down a prop which will tell the newly moved item to obtain focus
- In the `componentDidMount` lifecycle call back check if the item needs to gain focus based on its props (such as an `autoFocus` prop)
- If focus is required - call `.focus` on the node. You can obtain the node by using `ReactDOM.findDOMNode` or monkey patching the `provided.innerRef` callback.

### Other `hooks` information

**`onDragStart` and `onDragEnd` pairing**

We try very hard to ensure that each `onDragStart` event is paired with a single `onDragEnd` event. However, there maybe a rouge situation where this is not the case. If that occurs - it is a bug. Currently there is no mechanism to tell the library to cancel a current drag externally.

**Dynamic hooks**

Your *hook* functions will only be captured *once at start up*. Please do not change the function after that. If there is a valid use case for this then dynamic hooks could be supported. However, at this time it is not.
Your *hook* functions will only be captured *once at start up*. Please do not change the function after that. This behaviour will be changed soon to allow dynamic hooks.

## `Droppable`

Expand All @@ -437,7 +448,8 @@ import { Droppable } from 'react-beautiful-dnd';
ref={provided.innerRef}
style={{ backgroundColor: snapshot.isDraggingOver ? 'blue' : 'grey' }}
>
I am a droppable!
<h2>I am a droppable!</h2>
{provided.placeholder}
</div>
)}
</Droppable>;
Expand Down Expand Up @@ -468,14 +480,23 @@ The function is provided with two arguments:
```js
type DroppableProvided = {|
innerRef: (?HTMLElement) => void,
placeholder: ?ReactElement,
|}
```

In order for the droppable to function correctly, **you must** bind the `provided.innerRef` to the highest possible DOM node in the `ReactElement`. We do this in order to avoid needing to use `ReactDOM` to look up your DOM node.
- `provided.innerRef`: In order for the droppable to function correctly, **you must** bind the `provided.innerRef` to the highest possible DOM node in the `ReactElement`. We do this in order to avoid needing to use `ReactDOM` to look up your DOM node.

- `provided.placeholder`: This is used to create space in the `Droppable` as needed during a drag. This space is needed when a user is dragging over a list that is not the home list. Please be sure to put the placeholder inside of the component that you have provided the ref for. We need to increase the side of the `Droppable` itself. This is different from `Draggable` where the `placeholder` needs to be a *silbing* to the draggable node.

```js
<Droppable droppableId="droppable-1">
{(provided, snapshot) => <div ref={provided.innerRef}>Good to go</div>}
{(provided, snapshot) => (
<div ref={provided.innerRef}>
Good to go

{provided.placeholder}
</div>
)}
</Droppable>;
```

Expand All @@ -497,6 +518,8 @@ The `children` function is also provided with a small amount of state relating t
style={{ backgroundColor: snapshot.isDraggingOver ? 'blue' : 'grey' }}
>
I am a droppable!

{provided.placeholder}
</div>
)}
</Droppable>;
Expand Down Expand Up @@ -681,7 +704,7 @@ type NotDraggingStyle = {|
|};
```

- `provided.placeholder (?ReactElement)` The `Draggable` element has `position: fixed` applied to it while it is dragging. The role of the `placeholder` is to sit in the place that the `Draggable` was during a drag. It is needed to stop the `Droppable` list from collapsing when you drag. It is advised to render it as a sibling to the `Draggable` node. When the library moves to `React` 16 the `placeholder` will be removed from api.
- `provided.placeholder (?ReactElement)` The `Draggable` element has `position: fixed` applied to it while it is dragging. The role of the `placeholder` is to sit in the place that the `Draggable` was during a drag. It is needed to stop the `Droppable` list from collapsing when you drag. It is advised to render it as a sibling to the `Draggable` node. This is unlike `Droppable` where the `placeholder` needs to be *within* the `Droppable` node. When the library moves to `React` 16 the `placeholder` will be removed from api.

```js
<Draggable draggableId="draggable-1">
Expand Down Expand Up @@ -856,6 +879,11 @@ type DraggableLocation = {|
// Droppable
type DroppableProvided = {|
innerRef: (?HTMLElement) => void,
placeholder: ?ReactElement,
|}

type DraggableStateSnapshot = {|
isDraggingOver: boolean,
|}

// Draggable
Expand All @@ -865,6 +893,11 @@ type DraggableProvided = {|
dragHandleProps: ?DragHandleProvided,
placeholder: ?ReactElement,
|}

type DraggableStateSnapshot = {|
isDragging: boolean,
|}

type DraggableStyle = DraggingStyle | NotDraggingStyle
type DraggingStyle = {|
pointerEvents: 'none',
Expand Down
103 changes: 70 additions & 33 deletions src/state/action-creators.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,33 @@ import type {
InitialDrag,
} from '../types';
import noImpact from './no-impact';
import getNewHomeClientOffset from './get-new-home-client-offset';
import getNewHomeClientCenter from './get-new-home-client-center';
import { add, subtract, isEqual } from './position';

const origin: Position = { x: 0, y: 0 };

type ScrollDiffResult = {|
droppable: Position,
window: Position,
|}

const getScrollDiff = (
type ScrollDiffArgs = {|
initial: InitialDrag,
current: CurrentDrag,
droppable: DroppableDimension
): ScrollDiffResult => {
droppable: ?DroppableDimension
|}

const getScrollDiff = ({
initial,
current,
droppable,
}: ScrollDiffArgs): Position => {
const windowScrollDiff: Position = subtract(
initial.windowScroll,
current.windowScroll
);
const droppableScrollDiff: Position = subtract(

const droppableScrollDiff: Position = droppable ? subtract(
droppable.scroll.initial,
droppable.scroll.current
);
) : origin;

return {
window: windowScrollDiff,
droppable: droppableScrollDiff,
};
return add(windowScrollDiff, droppableScrollDiff);
};

export type RequestDimensionsAction = {|
Expand Down Expand Up @@ -72,6 +71,7 @@ export type CompleteLiftAction = {|
client: InitialDragLocation,
page: InitialDragLocation,
windowScroll: Position,
isScrollAllowed: boolean,
|}
|}

Expand All @@ -80,6 +80,7 @@ const completeLift = (id: DraggableId,
client: InitialDragLocation,
page: InitialDragLocation,
windowScroll: Position,
isScrollAllowed: boolean,
): CompleteLiftAction => ({
type: 'COMPLETE_LIFT',
payload: {
Expand All @@ -88,6 +89,7 @@ const completeLift = (id: DraggableId,
client,
page,
windowScroll,
isScrollAllowed,
},
});

Expand Down Expand Up @@ -130,6 +132,23 @@ export const updateDroppableDimensionScroll =
},
});

export type UpdateDroppableDimensionIsEnabledAction = {|
type: 'UPDATE_DROPPABLE_DIMENSION_IS_ENABLED',
payload: {
id: DroppableId,
isEnabled: boolean,
}
|}

export const updateDroppableDimensionIsEnabled =
(id: DroppableId, isEnabled: boolean): UpdateDroppableDimensionIsEnabledAction => ({
type: 'UPDATE_DROPPABLE_DIMENSION_IS_ENABLED',
payload: {
id,
isEnabled,
},
});

export type MoveAction = {|
type: 'MOVE',
payload: {|
Expand Down Expand Up @@ -190,6 +209,26 @@ export const moveForward = (id: DraggableId): MoveForwardAction => ({
payload: id,
});

export type CrossAxisMoveForwardAction = {|
type: 'CROSS_AXIS_MOVE_FORWARD',
payload: DraggableId
|}

export const crossAxisMoveForward = (id: DraggableId): CrossAxisMoveForwardAction => ({
type: 'CROSS_AXIS_MOVE_FORWARD',
payload: id,
});

export type CrossAxisMoveBackwardAction = {|
type: 'CROSS_AXIS_MOVE_BACKWARD',
payload: DraggableId
|}

export const crossAxisMoveBackward = (id: DraggableId): CrossAxisMoveBackwardAction => ({
type: 'CROSS_AXIS_MOVE_BACKWARD',
payload: id,
});

type CleanAction = {
type: 'CLEAN',
payload: null,
Expand Down Expand Up @@ -269,11 +308,10 @@ export const drop = () =>
}

const { impact, initial, current } = state.drag;
const sourceDroppable: DroppableDimension =
state.dimension.droppable[initial.source.droppableId];
const destinationDroppable: ?DroppableDimension = impact.destination ?
const droppable: ?DroppableDimension = impact.destination ?
state.dimension.droppable[impact.destination.droppableId] :
null;
const draggable: DraggableDimension = state.dimension.draggable[current.id];

const result: DropResult = {
draggableId: current.id,
Expand All @@ -282,22 +320,17 @@ export const drop = () =>
destination: impact.destination,
};

const scrollDiff = getScrollDiff(
initial,
current,
sourceDroppable,
);

const newHomeOffset: Position = getNewHomeClientOffset({
const newCenter: Position = getNewHomeClientCenter({
movement: impact.movement,
clientOffset: current.client.offset,
pageOffset: current.page.offset,
droppableScrollDiff: scrollDiff.droppable,
windowScrollDiff: scrollDiff.window,
draggable,
draggables: state.dimension.draggable,
axis: destinationDroppable ? destinationDroppable.axis : null,
destination: droppable,
});

const clientOffset: Position = subtract(newCenter, draggable.client.withMargin.center);
const scrollDiff: Position = getScrollDiff({ initial, current, droppable });
const newHomeOffset: Position = add(clientOffset, scrollDiff);

// Do not animate if you do not need to.
// This will be the case if either you are dragging with a
// keyboard or if you manage to nail it just with a mouse.
Expand Down Expand Up @@ -353,11 +386,11 @@ export const cancel = () =>
return;
}

const scrollDiff = getScrollDiff(initial, current, droppable);
const scrollDiff: Position = getScrollDiff({ initial, current, droppable });

dispatch(animateDrop({
trigger: 'CANCEL',
newHomeOffset: add(scrollDiff.droppable, scrollDiff.window),
newHomeOffset: scrollDiff,
impact: noImpact,
result,
}));
Expand Down Expand Up @@ -390,6 +423,7 @@ export type LiftAction = {|
client: InitialDragLocation,
page: InitialDragLocation,
windowScroll: Position,
isScrollAllowed: boolean,
|}
|}

Expand All @@ -399,6 +433,7 @@ export const lift = (id: DraggableId,
client: InitialDragLocation,
page: InitialDragLocation,
windowScroll: Position,
isScrollAllowed: boolean,
) => (dispatch: Dispatch, getState: Function) => {
(() => {
const state: State = getState();
Expand Down Expand Up @@ -436,7 +471,7 @@ export const lift = (id: DraggableId,
if (newState.phase !== 'COLLECTING_DIMENSIONS') {
return;
}
dispatch(completeLift(id, type, client, page, windowScroll));
dispatch(completeLift(id, type, client, page, windowScroll, isScrollAllowed));
});
});
};
Expand All @@ -449,6 +484,8 @@ export type Action = BeginLiftAction |
MoveAction |
MoveBackwardAction |
MoveForwardAction |
CrossAxisMoveForwardAction |
CrossAxisMoveBackwardAction |
DropAnimateAction |
DropCompleteAction |
CleanAction;
8 changes: 8 additions & 0 deletions src/state/axis.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,23 @@ import type { HorizontalAxis, VerticalAxis } from '../types';
export const vertical: VerticalAxis = {
direction: 'vertical',
line: 'y',
crossLine: 'x',
start: 'top',
end: 'bottom',
size: 'height',
crossAxisStart: 'left',
crossAxisEnd: 'right',
crossAxisSize: 'width',
};

export const horizontal: HorizontalAxis = {
direction: 'horizontal',
line: 'x',
crossLine: 'y',
start: 'left',
end: 'right',
size: 'width',
crossAxisStart: 'top',
crossAxisEnd: 'bottom',
crossAxisSize: 'height',
};
Loading