Browse Source

Fixed #402: background items not always be cleared when removing them

v3_develop
jos 10 years ago
parent
commit
0e4cdeee2e
6 changed files with 5068 additions and 5075 deletions
  1. +7
    -0
      HISTORY.md
  2. +5046
    -5053
      dist/vis.js
  3. +1
    -1
      dist/vis.map
  4. +8
    -8
      dist/vis.min.js
  5. +2
    -2
      lib/timeline/component/Group.js
  6. +4
    -11
      lib/timeline/component/ItemSet.js

+ 7
- 0
HISTORY.md View File

@ -2,6 +2,13 @@
http://visjs.org http://visjs.org
## not yet released, version 3.6.3
### Timeline
- Fixed background items not always be cleared when removing them.
## 2014-10-24, version 3.6.2 ## 2014-10-24, version 3.6.2
- Vis.js is now dual licensed under both Apache 2.0 and MIT. - Vis.js is now dual licensed under both Apache 2.0 and MIT.

+ 5046
- 5053
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


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


+ 2
- 2
lib/timeline/component/Group.js View File

@ -336,7 +336,7 @@ Group.prototype.orderSubgroups = function() {
} }
} }
} }
}
};
Group.prototype.resetSubgroups = function() { Group.prototype.resetSubgroups = function() {
for (var subgroup in this.subgroups) { for (var subgroup in this.subgroups) {
@ -352,7 +352,7 @@ Group.prototype.resetSubgroups = function() {
*/ */
Group.prototype.remove = function(item) { Group.prototype.remove = function(item) {
delete this.items[item.id]; delete this.items[item.id];
item.setParent(this.itemSet);
item.setParent(null);
// remove from visible items // remove from visible items
var index = this.visibleItems.indexOf(item); var index = this.visibleItems.indexOf(item);

+ 4
- 11
lib/timeline/component/ItemSet.js View File

@ -600,12 +600,7 @@ ItemSet.prototype._updateUngrouped = function() {
for (itemId in this.items) { for (itemId in this.items) {
if (this.items.hasOwnProperty(itemId)) { if (this.items.hasOwnProperty(itemId)) {
item = this.items[itemId]; item = this.items[itemId];
if (item instanceof BackgroundItem) {
background.add(item);
}
else {
ungrouped.add(item);
}
ungrouped.add(item);
} }
} }
@ -776,8 +771,8 @@ ItemSet.prototype._getType = function (itemData) {
*/ */
ItemSet.prototype._getGroupId = function (itemData) { ItemSet.prototype._getGroupId = function (itemData) {
var type = this._getType(itemData); var type = this._getType(itemData);
if (type == 'background') {
return this.groupsData && itemData.group != undefined ? itemData.group : BACKGROUND;
if (type == 'background' && itemData.group == undefined) {
return BACKGROUND;
} }
else { else {
return this.groupsData ? itemData.group : UNGROUPED; return this.groupsData ? itemData.group : UNGROUPED;
@ -1045,9 +1040,7 @@ ItemSet.prototype._removeItem = function(item) {
if (index != -1) this.selection.splice(index, 1); if (index != -1) this.selection.splice(index, 1);
// remove from group // remove from group
var groupId = this._getGroupId(item.data);
var group = this.groups[groupId];
if (group) group.remove(item);
item.parent && item.parent.remove(item);
}; };
/** /**

Loading…
Cancel
Save