Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ROI deletion feature #1880

Merged
merged 3 commits into from
Sep 4, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
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) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this line was causing the issue as it was not an exact match for start and end but we don't need this method now.

return {feature, set}
}
}
}

return {feature: undefined, set: undefined}
}

toJSON() {
return this.roiSets.map(roiSet => roiSet.toJSON())
}
Expand Down
5 changes: 3 additions & 2 deletions js/roi/ROIMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ class ROIMenu {
{
label: 'Delete',
click: () => {
this.browser.roiManager.deleteRegionWithKey(regionElement.dataset.region, this.browser.columnContainer)
this.browser.roiManager.repaintTable()
roiSet.removeFeature(feature)
roiManager.deleteRegionWithKey(regionElement.dataset.region, columnContainer)
roiManager.repaintTable()
}
}
)
Expand Down
Loading