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
504c8626
Commit
504c8626
authored
5 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-plugin: fixed PluginCommands.State.Highlight (wip)
parent
f4b29dc7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-plugin/behavior/static/state.ts
+14
-11
14 additions, 11 deletions
src/mol-plugin/behavior/static/state.ts
with
14 additions
and
11 deletions
src/mol-plugin/behavior/static/state.ts
+
14
−
11
View file @
504c8626
...
...
@@ -12,6 +12,8 @@ import { PluginStateObject as SO } from '../../state/objects';
import
{
getFormattedTime
}
from
'
../../../mol-util/date
'
;
import
{
readFromFile
}
from
'
../../../mol-util/data-source
'
;
import
{
download
}
from
'
../../../mol-util/download
'
;
import
{
Structure
}
from
'
../../../mol-model/structure
'
;
import
{
EmptyLoci
,
EveryLoci
}
from
'
../../../mol-model/loci
'
;
export
function
registerDefault
(
ctx
:
PluginContext
)
{
SyncBehaviors
(
ctx
);
...
...
@@ -99,24 +101,25 @@ function setVisibilityVisitor(t: StateTransform, tree: StateTree, ctx: { state:
ctx
.
state
.
updateCellState
(
t
.
ref
,
{
isHidden
:
ctx
.
value
});
}
// TODO make isHighlighted and isSelect part of StateObjectCell.State and subscribe from there???
// TODO select structures of subtree
// TODO should also work for volumes and shapes
export
function
Highlight
(
ctx
:
PluginContext
)
{
PluginCommands
.
State
.
Highlight
.
subscribe
(
ctx
,
({
state
,
ref
})
=>
{
// const cell = state.select(ref)[0]
// const repr = cell && SO.isRepresentation3D(cell.obj) ? cell.obj.data : undefined
// if (cell && cell.obj && cell.obj.type === PluginStateObject.Molecule.Structure.type) {
// ctx.behaviors.canvas3d.highlight.next({ current: { loci: Structure.Loci(cell.obj.data) } });
// } else if (repr) {
// ctx.behaviors.canvas3d.highlight.next({ current: { loci: EveryLoci, repr } });
// }
const
cell
=
state
.
select
(
ref
)[
0
];
if
(
!
cell
)
return
;
if
(
SO
.
Molecule
.
Structure
.
is
(
cell
.
obj
))
{
ctx
.
interactivity
.
lociHighlights
.
highlightOnly
({
loci
:
Structure
.
Loci
(
cell
.
obj
.
data
)
});
}
else
if
(
cell
&&
SO
.
isRepresentation3D
(
cell
.
obj
))
{
const
loci
=
SO
.
Molecule
.
Structure
.
is
(
cell
.
obj
.
data
.
source
)
?
Structure
.
Loci
(
cell
.
obj
.
data
.
source
.
data
)
:
EveryLoci
ctx
.
interactivity
.
lociHighlights
.
highlightOnly
({
loci
,
repr
:
cell
.
obj
.
data
.
repr
});
}
// TODO: highlight volumes and shapes?
// TODO: select structures of subtree?
});
}
export
function
ClearHighlight
(
ctx
:
PluginContext
)
{
PluginCommands
.
State
.
ClearHighlight
.
subscribe
(
ctx
,
({
state
,
ref
})
=>
{
//
ctx.
behaviors.canvas3d.highlight.next({ current:
{ loci: EmptyLoci
}
});
ctx
.
interactivity
.
lociHighlights
.
highlightOnly
(
{
loci
:
EmptyLoci
});
});
}
...
...
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