Skip to content
This repository was archived by the owner on Jul 29, 2019. It is now read-only.

[Timeline] Fixed tool-tip surviving after item deleted #2545

Merged
merged 1 commit into from
Jan 5, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/shared/Popup.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,13 @@ class Popup {
this.hidden = true;
this.frame.style.visibility = "hidden";
}

/**
* Remove the popup window
*/
destroy() {
this.frame.parentNode.removeChild(this.frame); // Remove element from DOM
}
}

export default Popup;
9 changes: 8 additions & 1 deletion lib/timeline/component/ItemSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -869,7 +869,8 @@ ItemSet.prototype.getGroups = function() {
*/
ItemSet.prototype.removeItem = function(id) {
var item = this.itemsData.get(id),
dataset = this.itemsData.getDataSet();
dataset = this.itemsData.getDataSet(),
itemObj = this.items[id];

if (item) {
// confirm deletion
Expand All @@ -878,6 +879,12 @@ ItemSet.prototype.removeItem = function(id) {
// remove by id here, it is possible that an item has no id defined
// itself, so better not delete by the item itself
dataset.remove(id);

// Remove it's popup
if (itemObj.popup) {
itemObj.popup.destroy();
itemObj.popup = null;
}
}
});
}
Expand Down