Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Molstar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
4a7f0fc2
Commit
4a7f0fc2
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
hide non-applicable repr types in repr ui
parent
6bbee58d
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-plugin/ui/structure/representation.tsx
+22
-7
22 additions, 7 deletions
src/mol-plugin/ui/structure/representation.tsx
src/mol-plugin/util/structure-selection-helper.ts
+2
-5
2 additions, 5 deletions
src/mol-plugin/util/structure-selection-helper.ts
with
24 additions
and
12 deletions
src/mol-plugin/ui/structure/representation.tsx
+
22
−
7
View file @
4a7f0fc2
...
...
@@ -16,15 +16,30 @@ import { VisualQuality, VisualQualityOptions } from '../../../mol-geo/geometry/b
import
{
StructureRepresentationPresets
as
P
}
from
'
../../util/structure-representation-helper
'
;
import
{
camelCaseToWords
}
from
'
../../../mol-util/string
'
;
import
{
CollapsableControls
}
from
'
../base
'
;
import
{
StateSelection
}
from
'
../../../mol-state
'
;
import
{
PluginStateObject
}
from
'
../../state/objects
'
;
abstract
class
BaseStructureRepresentationControls
extends
PluginUIComponent
{
onChange
=
(
value
:
string
)
=>
{
console
.
log
(
'
onChange
'
,
value
)
}
abstract
label
:
string
abstract
lociGetter
(
structure
:
Structure
):
StructureElement
.
Loci
/** root structures */
protected
get
structures
()
{
return
this
.
plugin
.
state
.
dataState
.
select
(
StateSelection
.
Generators
.
rootsOfType
(
PluginStateObject
.
Molecule
.
Structure
)).
map
(
s
=>
s
.
obj
!
.
data
)
}
/** applicapble types */
private
get
types
()
{
const
types
:
[
string
,
string
][]
=
[]
const
structures
=
this
.
structures
for
(
const
e
of
this
.
plugin
.
structureRepresentation
.
registry
.
list
)
{
if
(
structures
.
some
(
s
=>
e
.
provider
.
isApplicable
(
s
)))
{
types
.
push
([
e
.
name
,
e
.
provider
.
label
])
}
}
return
types
}
show
=
(
value
:
string
)
=>
{
this
.
plugin
.
helpers
.
structureRepresentation
.
set
(
'
add
'
,
value
,
this
.
lociGetter
)
}
...
...
@@ -46,19 +61,19 @@ abstract class BaseStructureRepresentationControls extends PluginUIComponent {
}
render
()
{
const
{
types
}
=
this
.
plugin
.
structureRepresentation
.
registry
const
TypeOptions
=
Options
(
this
.
types
)
return
<
div
className
=
'msp-control-row'
>
<
span
title
=
{
this
.
label
}
>
{
this
.
label
}
</
span
>
<
div
className
=
'msp-select-row'
>
<
ButtonSelect
label
=
'Show'
onChange
=
{
this
.
show
}
>
<
optgroup
label
=
'Show'
>
{
Options
(
types
)
}
</
optgroup
>
<
optgroup
label
=
'Show'
>
{
Type
Options
}
</
optgroup
>
</
ButtonSelect
>
<
ButtonSelect
label
=
'Hide'
onChange
=
{
this
.
hide
}
>
<
optgroup
label
=
'Clear'
>
<
option
key
=
{
'
__all__
'
}
value
=
{
'
__all__
'
}
>
All
</
option
>
</
optgroup
>
<
optgroup
label
=
'Hide'
>
{
Options
(
types
)
}
</
optgroup
>
<
optgroup
label
=
'Hide'
>
{
Type
Options
}
</
optgroup
>
</
ButtonSelect
>
<
ButtonSelect
label
=
'Color'
onChange
=
{
this
.
color
}
>
<
optgroup
label
=
'Clear'
>
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/util/structure-selection-helper.ts
+
2
−
5
View file @
4a7f0fc2
...
...
@@ -241,8 +241,7 @@ export type SelectionModifier = 'add' | 'remove' | 'only'
export
class
StructureSelectionHelper
{
private
get
structures
()
{
const
state
=
this
.
plugin
.
state
.
dataState
return
state
.
select
(
StateSelection
.
Generators
.
rootsOfType
(
PluginStateObject
.
Molecule
.
Structure
))
return
this
.
plugin
.
state
.
dataState
.
select
(
StateSelection
.
Generators
.
rootsOfType
(
PluginStateObject
.
Molecule
.
Structure
)).
map
(
s
=>
s
.
obj
!
.
data
)
}
private
_set
(
modifier
:
SelectionModifier
,
loci
:
Loci
)
{
...
...
@@ -260,9 +259,7 @@ export class StructureSelectionHelper {
}
set
(
modifier
:
SelectionModifier
,
query
:
StructureQuery
)
{
for
(
const
so
of
this
.
structures
)
{
const
s
=
so
.
obj
!
.
data
for
(
const
s
of
this
.
structures
)
{
const
current
=
this
.
plugin
.
helpers
.
structureSelectionManager
.
get
(
s
)
const
currentSelection
=
Loci
.
isEmpty
(
current
)
?
StructureSelection
.
Empty
(
s
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment