Skip to content

Commit 5631d25

Browse files
committed
MAGETWO-51049: Incorrect behavior of DragAndDrop for Dynamic Rows
1 parent 3fa0347 commit 5631d25

File tree

2 files changed

+11
-6
lines changed
  • app
    • code/Magento/Ui/view/base/web/js/dynamic-rows
    • design/adminhtml/Magento/backend/web/css/source/forms/fields

2 files changed

+11
-6
lines changed

app/code/Magento/Ui/view/base/web/js/dynamic-rows/dnd.js

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -199,9 +199,13 @@ define([
199199
/**
200200
* Mouse up handler
201201
*/
202-
mouseupHandler: function () {
202+
mouseupHandler: function (event) {
203203
var depElementCtx,
204-
drEl = this.draggableElement;
204+
drEl = this.draggableElement,
205+
pageY = isTouchDevice ? event.originalEvent.touches[0].pageY : event.pageY,
206+
positionY = pageY - drEl.eventMousedownY;
207+
208+
drEl.depElement = this.getDepElement(drEl.instance, positionY);
205209

206210
if (drEl.depElement) {
207211
depElementCtx = this.getRecord(drEl.depElement.elem[0]);
@@ -285,12 +289,12 @@ define([
285289
rec = collection.eq(i);
286290

287291
if (position === 'before') {
288-
rangeStart = collection.eq(i).position().top;
289-
rangeEnd = rangeStart + this.step;
292+
rangeStart = collection.eq(i).position().top - this.step;
293+
rangeEnd = rangeStart + this.step * 2;
290294
className = this.separatorsClass.top;
291295
} else if (position === 'after') {
292-
rangeEnd = rec.position().top + rec.height();
293-
rangeStart = rangeEnd - this.step;
296+
rangeEnd = rec.position().top + rec.height() + this.step;
297+
rangeStart = rangeEnd - this.step * 2;
294298
className = this.separatorsClass.bottom;
295299
}
296300

app/design/adminhtml/Magento/backend/web/css/source/forms/fields/_control-table.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,7 @@
188188

189189
.admin__dynamic-rows {
190190
&._dragged {
191+
opacity: .95;
191192
position: absolute;
192193
z-index: 999;
193194
}

0 commit comments

Comments
 (0)