Skip to content
Snippets Groups Projects
Unverified Commit f27dafed authored by xgui3783's avatar xgui3783 Committed by GitHub
Browse files

Merge pull request #691 from HumanBrainProject/bugfix_multiRegionSelectionInViewer

chore: allow only one region to be selected
parents 0f58219b 6e5b6e11
No related branches found
No related tags found
No related merge requests found
const { AtlasPage } = require('../../src/util')
const { height, width } = require('../../opts')
describe('> selecting regions', () => {
const duplicatedRegion = {
atlas: 'Multilevel Human Atlas',
template: `ICBM 152 2009c Nonlinear Asymmetric`,
position: [-0.256, 26.028, -11.678]
}
describe(`> when selecting duplicated regions at ${duplicatedRegion.atlas} / ${duplicatedRegion.template} / ${JSON.stringify(duplicatedRegion.position)}`, () => {
it(`> when click, should only select a single region`, async () => {
const newPage = new AtlasPage()
await newPage.init()
await newPage.goto()
await newPage.selectAtlasTemplateParcellation(duplicatedRegion.atlas, duplicatedRegion.template)
await newPage.wait(500)
await newPage.waitForAsync()
await newPage.execScript(`interactiveViewer.viewerHandle.setNavigationLoc(${JSON.stringify(duplicatedRegion.position.map(v => v*1e6))}, true)`)
await newPage.wait(500)
await newPage.cursorMoveTo({
position: [ width * 3 / 4, height / 4 ]
})
await newPage.wait(500)
const txt = await newPage.getText(`[floatingMouseContextualContainerDirective]`)
expect(txt.indexOf(`left`)).toBeGreaterThanOrEqual(0)
expect(txt.indexOf(`right`)).toBeGreaterThanOrEqual(0)
await newPage.cursorMoveToAndClick({
position: [width * 3 / 4, height / 4]
})
await newPage.wait(500)
await newPage.waitForAsync()
const visible = await newPage.areVisible(`region-menu`)
expect(visible.length).toEqual(1)
})
})
})
......@@ -435,7 +435,7 @@ export class AtlasViewer implements OnDestroy, OnInit, AfterViewInit {
if (!this.onhoverSegments) return
this.store.dispatch(
viewerStateSetSelectedRegions({
selectRegions: this.onhoverSegments
selectRegions: this.onhoverSegments.slice(0, 1)
})
)
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment