Skip to content

Commit

Permalink
shadow default min/max bounds updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Kutlu Sahin committed Mar 28, 2019
1 parent 9f4688f commit d3ca64d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ function getShadowBeginEnd({ draggables, layout }: ContainerProps) {
if (addedIndex !== null && (draggableInfo.invalidateShadow || addedIndex !== prevAddedIndex)) {
// if (prevAddedIndex) prevAddedIndex = addedIndex;
let beforeIndex = addedIndex - 1;
let begin = 0;
let begin = Number.MIN_SAFE_INTEGER;
let dropAreaBegin = 0;
let dropAreaEnd = 0;
let afterBounds = null;
Expand All @@ -498,7 +498,7 @@ function getShadowBeginEnd({ draggables, layout }: ContainerProps) {
dropAreaBegin = layout.getBeginEndOfContainer().begin;
}

let end = 10000;
let end = Number.MAX_SAFE_INTEGER;
let afterIndex = addedIndex;
if (afterIndex === removedIndex) {
afterIndex++;
Expand Down
6 changes: 4 additions & 2 deletions src/mediator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -381,8 +381,10 @@ function onMouseMove(event: MouseEvent & TouchEvent) {
draggableInfo.position.y = Math.max(beginEnd.begin + 1, Math.min(beginEnd.end - 1, (e.clientY + ghostInfo.centerDelta.y)));
draggableInfo.mousePosition.y = Math.max(beginEnd.begin + 1, Math.min(beginEnd.end - 1, e.clientY));
} else {
const beginBoundary = beginEnd.begin - (draggableInfo.size.offsetWidth / 2);
const endBoundary = beginEnd.end - (draggableInfo.size.offsetWidth / 2);
// const beginBoundary = beginEnd.begin - (draggableInfo.size.offsetWidth / 2);
// const endBoundary = beginEnd.end - (draggableInfo.size.offsetWidth / 2);
const beginBoundary = beginEnd.begin;
const endBoundary = beginEnd.end - draggableInfo.size.offsetWidth;
const positionInBoundary = Math.max(beginBoundary, Math.min(endBoundary, (e.clientX + ghostInfo.positionDelta.left)));

ghostInfo.topLeft.x = positionInBoundary;
Expand Down

0 comments on commit d3ca64d

Please sign in to comment.