Skip to content
Snippets Groups Projects
Commit 79b33bfb authored by Alexander Rose's avatar Alexander Rose
Browse files

selection and focus tweaks

- support highlight for current selection UI
parent f5fc96ee
No related branches found
No related tags found
No related merge requests found
...@@ -119,7 +119,9 @@ export class StructureFocusControls extends PluginUIComponent<{}, StructureFocus ...@@ -119,7 +119,9 @@ export class StructureFocusControls extends PluginUIComponent<{}, StructureFocus
...ActionMenu.createItems(history, { ...ActionMenu.createItems(history, {
label: f => f.label, label: f => f.label,
description: f => { description: f => {
return f.label !== f.category ? `${f.category} | ${f.label}` : f.label return f.category && f.label !== f.category
? `${f.category} | ${f.label}`
: f.label
} }
}) })
]) ])
......
...@@ -76,9 +76,8 @@ export class StructureSelectionControls<P, S extends StructureSelectionControlsS ...@@ -76,9 +76,8 @@ export class StructureSelectionControls<P, S extends StructureSelectionControlsS
focus = () => { focus = () => {
if (this.plugin.managers.structure.selection.stats.elementCount === 0) return; if (this.plugin.managers.structure.selection.stats.elementCount === 0) return;
const principalAxes = this.plugin.managers.structure.selection.getPrincipalAxes();
const { sphere } = this.plugin.managers.structure.selection.getBoundary(); const { sphere } = this.plugin.managers.structure.selection.getBoundary();
this.plugin.managers.camera.focusSphere(sphere, { principalAxes }); this.plugin.managers.camera.focusSphere(sphere);
} }
setProps = (props: any) => { setProps = (props: any) => {
...@@ -132,6 +131,17 @@ export class StructureSelectionControls<P, S extends StructureSelectionControlsS ...@@ -132,6 +131,17 @@ export class StructureSelectionControls<P, S extends StructureSelectionControlsS
toggleSet = this.showAction('set') toggleSet = this.showAction('set')
toggleColor = this.showAction('color') toggleColor = this.showAction('color')
highlight = (e: React.MouseEvent<HTMLElement>) => {
this.plugin.managers.interactivity.lociHighlights.clearHighlights();
this.plugin.managers.structure.selection.entries.forEach(e => {
this.plugin.managers.interactivity.lociHighlights.highlight({ loci: e.selection }, false);
})
}
clearHighlight = () => {
this.plugin.managers.interactivity.lociHighlights.clearHighlights();
}
get controls() { get controls() {
return <> return <>
<div className='msp-flex-row'> <div className='msp-flex-row'>
...@@ -170,7 +180,7 @@ export class StructureSelectionControls<P, S extends StructureSelectionControlsS ...@@ -170,7 +180,7 @@ export class StructureSelectionControls<P, S extends StructureSelectionControlsS
<ParameterControls params={StructureSelectionParams} values={this.values} onChangeValues={this.setProps} /> <ParameterControls params={StructureSelectionParams} values={this.values} onChangeValues={this.setProps} />
{this.controls} {this.controls}
<div className='msp-flex-row' style={{ margin: '6px 0' }}> <div className='msp-flex-row' style={{ margin: '6px 0' }}>
<Button noOverflow onClick={this.focus} title='Click to Focus Selection' disabled={empty} <Button noOverflow onClick={this.focus} title='Click to Focus Selection' disabled={empty} onMouseEnter={this.highlight} onMouseLeave={this.clearHighlight}
style={{ textAlignLast: !empty ? 'left' : void 0 }}> style={{ textAlignLast: !empty ? 'left' : void 0 }}>
{this.stats} {this.stats}
</Button> </Button>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment