Skip to content

Commit

Permalink
Fixed deletion of ROI
Browse files Browse the repository at this point in the history
  • Loading branch information
milandomazet committed Sep 2, 2024
1 parent f15d9fa commit ba03776
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 24 deletions.
24 changes: 0 additions & 24 deletions js/roi/ROIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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())
}
Expand Down
1 change: 1 addition & 0 deletions js/roi/ROIMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down

0 comments on commit ba03776

Please sign in to comment.