Browse Source

Fixed #252: canceling moving an item to another group did not move the item back to the original group.

v3_develop
jos 10 years ago
parent
commit
cb3e652721
5 changed files with 4322 additions and 4292 deletions
  1. +2
    -0
      HISTORY.md
  2. +4290
    -4276
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +6
    -6
      dist/vis.min.js
  5. +23
    -9
      lib/timeline/component/ItemSet.js

+ 2
- 0
HISTORY.md View File

@ -7,6 +7,8 @@ http://visjs.org
### Timeline
- Fixed the `change` event sometimes being fired twice on IE10.
- Fixed canceling moving an item to another group did not move the item
back to the original group.
### Network

+ 4290
- 4276
dist/vis.js
File diff suppressed because it is too large
View File


+ 1
- 1
dist/vis.map
File diff suppressed because it is too large
View File


+ 6
- 6
dist/vis.min.js
File diff suppressed because it is too large
View File


+ 23
- 9
lib/timeline/component/ItemSet.js View File

@ -1118,15 +1118,7 @@ ItemSet.prototype._onDrag = function (event) {
if ('group' in props) {
// drag from one group to another
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
* @param {Event} event
@ -1185,6 +1195,10 @@ ItemSet.prototype._onDragEnd = function (event) {
// restore original values
if ('start' in props) props.item.data.start = props.start;
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.body.emitter.emit('change');

Loading…
Cancel
Save