From 73f880d9f4d0e195462e332b3ca9b4f4b1e322ac Mon Sep 17 00:00:00 2001 From: yotamberk Date: Tue, 20 Dec 2016 22:28:34 +0200 Subject: [PATCH] Fix initial drag (#2474) * Fix redraw order * Fix initial drag item bug * Fix indents --- lib/timeline/component/ItemSet.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/timeline/component/ItemSet.js b/lib/timeline/component/ItemSet.js index 53de50af..24ba15ce 100644 --- a/lib/timeline/component/ItemSet.js +++ b/lib/timeline/component/ItemSet.js @@ -1235,6 +1235,7 @@ ItemSet.prototype._onDragStart = function (event) { var dragLeftItem = this.touchParams.dragLeftItem; var dragRightItem = this.touchParams.dragRightItem; this.touchParams.itemIsDragging = true; + this.touchParams.selectedItem = item; if (dragLeftItem) { props = { @@ -1257,8 +1258,6 @@ ItemSet.prototype._onDragStart = function (event) { this.touchParams.itemProps = [props]; } else { - this.touchParams.selectedItem = item; - var baseGroupIndex = this._getGroupIndex(item.data.group); var itemsToDrag = (this.options.itemsAlwaysDraggable && !item.selected) ? [item.id] : this.getSelection(); @@ -1323,7 +1322,8 @@ ItemSet.prototype._onDragStartAddItem = function (event) { newItem.id = id; // TODO: not so nice setting id afterwards newItem.data = this._cloneItemData(itemData); this._addItem(newItem); - + this.touchParams.selectedItem = newItem; + var props = { item: newItem, initialX: event.center.x,