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
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Michal Malý
Molstar
Commits
fcf559fa
Commit
fcf559fa
authored
5 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
toggle hydrogens in structure view tools
parent
27963b5a
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-plugin/ui/structure/representation.tsx
+25
-1
25 additions, 1 deletion
src/mol-plugin/ui/structure/representation.tsx
src/mol-plugin/util/structure-representation-helper.ts
+34
-8
34 additions, 8 deletions
src/mol-plugin/util/structure-representation-helper.ts
with
59 additions
and
9 deletions
src/mol-plugin/ui/structure/representation.tsx
+
25
−
1
View file @
fcf559fa
...
@@ -8,11 +8,12 @@ import * as React from 'react';
...
@@ -8,11 +8,12 @@ import * as React from 'react';
import
{
PluginUIComponent
}
from
'
../base
'
;
import
{
PluginUIComponent
}
from
'
../base
'
;
import
{
Structure
,
StructureElement
}
from
'
../../../mol-model/structure
'
;
import
{
Structure
,
StructureElement
}
from
'
../../../mol-model/structure
'
;
import
{
isEmptyLoci
}
from
'
../../../mol-model/loci
'
;
import
{
isEmptyLoci
}
from
'
../../../mol-model/loci
'
;
import
{
ColorOptions
}
from
'
../controls/parameters
'
;
import
{
ColorOptions
,
ParameterControls
}
from
'
../controls/parameters
'
;
import
{
Color
}
from
'
../../../mol-util/color
'
;
import
{
Color
}
from
'
../../../mol-util/color
'
;
import
{
ButtonSelect
,
Options
}
from
'
../controls/common
'
;
import
{
ButtonSelect
,
Options
}
from
'
../controls/common
'
;
import
{
StructureSelectionQueries
as
Q
}
from
'
../../util/structure-selection-helper
'
;
import
{
StructureSelectionQueries
as
Q
}
from
'
../../util/structure-selection-helper
'
;
import
{
MolScriptBuilder
as
MS
}
from
'
../../../mol-script/language/builder
'
;
import
{
MolScriptBuilder
as
MS
}
from
'
../../../mol-script/language/builder
'
;
import
{
ParamDefinition
as
PD
}
from
'
../../../mol-util/param-definition
'
;
abstract
class
BaseStructureRepresentationControls
extends
PluginUIComponent
{
abstract
class
BaseStructureRepresentationControls
extends
PluginUIComponent
{
onChange
=
(
value
:
string
)
=>
{
onChange
=
(
value
:
string
)
=>
{
...
@@ -92,6 +93,27 @@ export class StructureRepresentationControls extends PluginUIComponent {
...
@@ -92,6 +93,27 @@ export class StructureRepresentationControls extends PluginUIComponent {
]))
]))
}
}
onChange
=
async
(
p
:
{
param
:
PD
.
Base
<
any
>
,
name
:
string
,
value
:
any
})
=>
{
if
(
p
.
name
===
'
showHydrogens
'
)
{
await
this
.
plugin
.
helpers
.
structureRepresentation
.
setIgnoreHydrogens
(
!
p
.
value
)
}
this
.
forceUpdate
()
}
get
params
()
{
const
values
=
this
.
values
return
{
showHydrogens
:
PD
.
Boolean
(
values
.
showHydrogens
)
}
}
get
values
()
{
const
{
structureRepresentation
:
rep
}
=
this
.
plugin
.
helpers
return
{
showHydrogens
:
!
rep
.
ignoreHydrogens
}
}
render
()
{
render
()
{
return
<
div
className
=
'msp-transform-wrapper'
>
return
<
div
className
=
'msp-transform-wrapper'
>
<
div
className
=
'msp-transform-header'
>
<
div
className
=
'msp-transform-header'
>
...
@@ -102,6 +124,8 @@ export class StructureRepresentationControls extends PluginUIComponent {
...
@@ -102,6 +124,8 @@ export class StructureRepresentationControls extends PluginUIComponent {
</
div
>
</
div
>
<
EverythingStructureRepresentationControls
/>
<
EverythingStructureRepresentationControls
/>
<
SelectionStructureRepresentationControls
/>
<
SelectionStructureRepresentationControls
/>
<
ParameterControls
params
=
{
this
.
params
}
values
=
{
this
.
values
}
onChange
=
{
this
.
onChange
}
/>
</
div
>
</
div
>
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-plugin/util/structure-representation-helper.ts
+
34
−
8
View file @
fcf559fa
...
@@ -62,20 +62,18 @@ export class StructureRepresentationHelper {
...
@@ -62,20 +62,18 @@ export class StructureRepresentationHelper {
})
})
}
else
{
}
else
{
const
combinedLoci
=
getCombinedLoci
(
modifier
,
loci
,
StructureElement
.
Loci
(
s
,
[]))
const
combinedLoci
=
getCombinedLoci
(
modifier
,
loci
,
StructureElement
.
Loci
(
s
,
[]))
const
params
=
StructureRepresentation3DHelpers
.
getDefaultParams
(
this
.
plugin
,
type
as
any
,
s
)
if
(
params
.
type
.
params
.
ignoreHydrogens
!==
undefined
)
{
params
.
type
.
params
.
ignoreHydrogens
=
this
.
_ignoreHydrogens
}
update
.
to
(
structure
.
transform
.
ref
)
update
.
to
(
structure
.
transform
.
ref
)
.
apply
(
.
apply
(
StateTransforms
.
Model
.
LociStructureSelection
,
StateTransforms
.
Model
.
LociStructureSelection
,
{
{
query
:
StructureElement
.
Query
.
fromLoci
(
combinedLoci
),
label
:
type
},
query
:
StructureElement
.
Query
.
fromLoci
(
combinedLoci
),
label
:
type
},
{
tags
:
[
RepresentationManagerTag
,
getRepresentationManagerTag
(
type
)
]
}
{
tags
:
[
RepresentationManagerTag
,
getRepresentationManagerTag
(
type
)
]
}
)
)
.
apply
(
.
apply
(
StateTransforms
.
Representation
.
StructureRepresentation3D
,
params
)
StateTransforms
.
Representation
.
StructureRepresentation3D
,
StructureRepresentation3DHelpers
.
getDefaultParams
(
this
.
plugin
,
type
as
any
,
s
)
)
}
}
await
this
.
plugin
.
runTask
(
state
.
updateTree
(
update
,
{
doNotUpdateCurrent
:
true
}))
await
this
.
plugin
.
runTask
(
state
.
updateTree
(
update
,
{
doNotUpdateCurrent
:
true
}))
...
@@ -100,6 +98,34 @@ export class StructureRepresentationHelper {
...
@@ -100,6 +98,34 @@ export class StructureRepresentationHelper {
})
})
}
}
private
_ignoreHydrogens
=
false
get
ignoreHydrogens
()
{
return
this
.
_ignoreHydrogens
}
async
setIgnoreHydrogens
(
ignoreHydrogens
:
boolean
)
{
if
(
ignoreHydrogens
===
this
.
_ignoreHydrogens
)
return
const
{
registry
}
=
this
.
plugin
.
structureRepresentation
const
state
=
this
.
plugin
.
state
.
dataState
;
const
update
=
state
.
build
()
const
structures
=
state
.
select
(
StateSelection
.
Generators
.
rootsOfType
(
PSO
.
Molecule
.
Structure
))
for
(
const
structure
of
structures
)
{
for
(
let
i
=
0
,
il
=
registry
.
types
.
length
;
i
<
il
;
++
i
)
{
const
type
=
registry
.
types
[
i
][
0
]
const
repr
=
this
.
getRepresentation
(
structure
.
transform
.
ref
,
type
)
if
(
repr
&&
repr
.
params
&&
repr
.
params
.
values
.
type
.
params
.
ignoreHydrogens
!==
undefined
)
{
const
{
name
,
params
}
=
repr
.
params
.
values
.
type
update
.
to
(
repr
.
transform
.
ref
).
update
(
StateTransforms
.
Representation
.
StructureRepresentation3D
,
props
=>
({
...
props
,
type
:
{
name
,
params
:
{
...
params
,
ignoreHydrogens
}}})
)
}
}
}
await
this
.
plugin
.
runTask
(
state
.
updateTree
(
update
,
{
doNotUpdateCurrent
:
true
}))
this
.
_ignoreHydrogens
=
ignoreHydrogens
}
constructor
(
private
plugin
:
PluginContext
)
{
constructor
(
private
plugin
:
PluginContext
)
{
}
}
...
...
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