Skip to content

Commit d018001

Browse files
committed
[SortZone] Fix gap handling and remove itemMargin config #8043
1 parent 00cad25 commit d018001

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/draggable/container/SortZone.mjs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ class SortZone extends DragZone {
4949
* @protected
5050
*/
5151
indexMap: null,
52-
/**
53-
* @member {String|null} itemMargin=null
54-
* @protected
55-
*/
56-
itemMargin: null,
5752
/**
5853
* @member {Array|null} itemRects=null
5954
* @protected
@@ -423,7 +418,7 @@ class SortZone extends DragZone {
423418
item.wrapperStyle = Object.assign(itemStyle, {
424419
height : `${rect.height}px`,
425420
left : `${rect.left}px`,
426-
margin : me.itemMargin,
421+
margin : '0px',
427422
position: 'absolute',
428423
top : `${rect.top}px`,
429424
width : `${rect.width}px`
@@ -489,13 +484,17 @@ class SortZone extends DragZone {
489484
rect2Copy = rect2.clone();
490485

491486
if (me.sortDirection === 'horizontal') {
487+
const gap = rect2Copy.x - (rect1Copy.x + rect1Copy.width);
488+
492489
rect1.width = rect2Copy.width;
493-
rect2.x = rect1Copy.x + rect2Copy.width;
490+
rect2.x = rect1Copy.x + rect2Copy.width + gap;
494491
rect2.width = rect1Copy.width
495492
} else {
493+
const gap = rect2Copy.y - (rect1Copy.y + rect1Copy.height);
494+
496495
rect1.height = rect2Copy.height;
497496
rect2.height = rect1Copy.height;
498-
rect2.y = rect1Copy.y + rect2Copy.height;
497+
rect2.y = rect1Copy.y + rect2Copy.height + gap;
499498
}
500499

501500
tmp = map[index1];

0 commit comments

Comments
 (0)