|
@ -1118,15 +1118,7 @@ ItemSet.prototype._onDrag = function (event) { |
|
|
if ('group' in props) { |
|
|
if ('group' in props) { |
|
|
// drag from one group to another
|
|
|
// drag from one group to another
|
|
|
var group = ItemSet.groupFromTarget(event); |
|
|
var group = ItemSet.groupFromTarget(event); |
|
|
if (group && group.groupId != props.item.data.group) { |
|
|
|
|
|
var oldGroup = props.item.parent; |
|
|
|
|
|
oldGroup.remove(props.item); |
|
|
|
|
|
oldGroup.order(); |
|
|
|
|
|
group.add(props.item); |
|
|
|
|
|
group.order(); |
|
|
|
|
|
|
|
|
|
|
|
props.item.data.group = group.groupId; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
_moveToGroup(props.item, group); |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
@ -1139,6 +1131,24 @@ ItemSet.prototype._onDrag = function (event) { |
|
|
} |
|
|
} |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Move an item to another group |
|
|
|
|
|
* @param {Item} item |
|
|
|
|
|
* @param {Group} group |
|
|
|
|
|
* @private |
|
|
|
|
|
*/ |
|
|
|
|
|
function _moveToGroup (item, group) { |
|
|
|
|
|
if (group && group.groupId != item.data.group) { |
|
|
|
|
|
var oldGroup = item.parent; |
|
|
|
|
|
oldGroup.remove(item); |
|
|
|
|
|
oldGroup.order(); |
|
|
|
|
|
group.add(item); |
|
|
|
|
|
group.order(); |
|
|
|
|
|
|
|
|
|
|
|
item.data.group = group.groupId; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* End of dragging selected items |
|
|
* End of dragging selected items |
|
|
* @param {Event} event |
|
|
* @param {Event} event |
|
@ -1185,6 +1195,10 @@ ItemSet.prototype._onDragEnd = function (event) { |
|
|
// restore original values
|
|
|
// restore original values
|
|
|
if ('start' in props) props.item.data.start = props.start; |
|
|
if ('start' in props) props.item.data.start = props.start; |
|
|
if ('end' in props) props.item.data.end = props.end; |
|
|
if ('end' in props) props.item.data.end = props.end; |
|
|
|
|
|
if ('group' in props && props.item.data.group != props.group) { |
|
|
|
|
|
var group = me.groups[props.group]; |
|
|
|
|
|
_moveToGroup(props.item, group); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
me.stackDirty = true; // force re-stacking of all items next redraw
|
|
|
me.stackDirty = true; // force re-stacking of all items next redraw
|
|
|
me.body.emitter.emit('change'); |
|
|
me.body.emitter.emit('change'); |
|
|