From ba037763bf5d55daf64ee767036b6b8f67e254ee Mon Sep 17 00:00:00 2001 From: Milan Domazet Date: Mon, 2 Sep 2024 20:18:02 +0200 Subject: [PATCH] Fixed deletion of ROI --- js/roi/ROIManager.js | 24 ------------------------ js/roi/ROIMenu.js | 1 + 2 files changed, 1 insertion(+), 24 deletions(-) diff --git a/js/roi/ROIManager.js b/js/roi/ROIManager.js index 0a4a4757a..0f9e97f45 100644 --- a/js/roi/ROIManager.js +++ b/js/roi/ROIManager.js @@ -289,15 +289,8 @@ class ROIManager { } async deleteRegionWithKey(regionKey, columnContainer) { - columnContainer.querySelectorAll(createSelector(regionKey)).forEach(node => node.remove()) - const {feature, set} = await this.findRegionWithKey(regionKey) - - if (set) { - set.removeFeature(feature) - } - const records = await this.getTableRecords() if (0 === records.length) { @@ -307,23 +300,6 @@ class ROIManager { } - async findRegionWithKey(regionKey) { - - const {chr, start, end} = parseRegionKey(regionKey) - - for (let set of this.roiSets) { - const features = await set.getFeatures(chr, start, end) - - for (let feature of features) { - if (feature.chr === chr && feature.start >= start && feature.end <= end) { - return {feature, set} - } - } - } - - return {feature: undefined, set: undefined} - } - toJSON() { return this.roiSets.map(roiSet => roiSet.toJSON()) } diff --git a/js/roi/ROIMenu.js b/js/roi/ROIMenu.js index e037215f7..c83e89cc2 100644 --- a/js/roi/ROIMenu.js +++ b/js/roi/ROIMenu.js @@ -110,6 +110,7 @@ class ROIMenu { { label: 'Delete', click: () => { + roiSet.removeFeature(feature) this.browser.roiManager.deleteRegionWithKey(regionElement.dataset.region, this.browser.columnContainer) this.browser.roiManager.repaintTable() }