Browse Source

Fix initial drag (#2474)

* Fix redraw order

* Fix initial drag item bug

* Fix indents
readme-improvements
yotamberk 8 years ago
committed by GitHub
parent
commit
73f880d9f4
1 changed files with 3 additions and 3 deletions
  1. +3
    -3
      lib/timeline/component/ItemSet.js

+ 3
- 3
lib/timeline/component/ItemSet.js View File

@ -1235,6 +1235,7 @@ ItemSet.prototype._onDragStart = function (event) {
var dragLeftItem = this.touchParams.dragLeftItem; var dragLeftItem = this.touchParams.dragLeftItem;
var dragRightItem = this.touchParams.dragRightItem; var dragRightItem = this.touchParams.dragRightItem;
this.touchParams.itemIsDragging = true; this.touchParams.itemIsDragging = true;
this.touchParams.selectedItem = item;
if (dragLeftItem) { if (dragLeftItem) {
props = { props = {
@ -1257,8 +1258,6 @@ ItemSet.prototype._onDragStart = function (event) {
this.touchParams.itemProps = [props]; this.touchParams.itemProps = [props];
} }
else { else {
this.touchParams.selectedItem = item;
var baseGroupIndex = this._getGroupIndex(item.data.group); var baseGroupIndex = this._getGroupIndex(item.data.group);
var itemsToDrag = (this.options.itemsAlwaysDraggable && !item.selected) ? [item.id] : this.getSelection(); 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.id = id; // TODO: not so nice setting id afterwards
newItem.data = this._cloneItemData(itemData); newItem.data = this._cloneItemData(itemData);
this._addItem(newItem); this._addItem(newItem);
this.touchParams.selectedItem = newItem;
var props = { var props = {
item: newItem, item: newItem,
initialX: event.center.x, initialX: event.center.x,

Loading…
Cancel
Save