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
c1627292
Commit
c1627292
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
mol-plugin: clear selection on Ctrl + right on nothing
parent
c87af170
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/behavior/dynamic/representation.ts
+7
-1
7 additions, 1 deletion
src/mol-plugin/behavior/dynamic/representation.ts
src/mol-plugin/util/structure-element-selection.ts
+13
-0
13 additions, 0 deletions
src/mol-plugin/util/structure-element-selection.ts
with
20 additions
and
1 deletion
src/mol-plugin/behavior/dynamic/representation.ts
+
7
−
1
View file @
c1627292
...
...
@@ -73,7 +73,13 @@ export const SelectLoci = PluginBehavior.create({
this
.
subscribeObservable
(
this
.
ctx
.
events
.
canvas3d
.
click
,
({
current
,
buttons
,
modifiers
})
=>
{
if
(
!
this
.
ctx
.
canvas3d
)
return
;
if
(
StructureElement
.
isLoci
(
current
.
loci
))
{
if
(
current
.
loci
.
kind
===
'
empty-loci
'
)
{
if
(
modifiers
.
control
&&
buttons
===
ButtonsType
.
Flag
.
Secondary
)
{
// clear the selection on Ctrl + Right-Click on empty
const
sels
=
sel
.
clear
();
for
(
const
s
of
sels
)
this
.
ctx
.
canvas3d
.
mark
({
loci
:
s
},
MarkerAction
.
Deselect
);
}
}
else
if
(
StructureElement
.
isLoci
(
current
.
loci
))
{
if
(
modifiers
.
control
&&
buttons
===
ButtonsType
.
Flag
.
Secondary
)
{
// select only the current element on Ctrl + Right-Click
const
old
=
sel
.
get
(
current
.
loci
.
structure
);
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/util/structure-element-selection.ts
+
13
−
0
View file @
c1627292
...
...
@@ -50,6 +50,19 @@ class StructureElementSelectionManager {
return
entry
.
selection
.
elements
.
length
===
0
?
EmptyLoci
:
entry
.
selection
;
}
clear
()
{
const
keys
=
this
.
entries
.
keys
();
const
selections
:
StructureElement
.
Loci
[]
=
[];
while
(
true
)
{
const
k
=
keys
.
next
();
if
(
k
.
done
)
break
;
const
s
=
this
.
entries
.
get
(
k
.
value
)
!
;
if
(
s
.
selection
.
elements
.
length
>
0
)
selections
.
push
(
s
.
selection
);
s
.
selection
=
StructureElement
.
Loci
(
s
.
selection
.
structure
,
[]);
}
return
selections
;
}
get
(
structure
:
Structure
)
{
const
entry
=
this
.
getEntry
(
structure
);
if
(
!
entry
)
return
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