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
f3353b6e
Commit
f3353b6e
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
fixed units-representation update (don't use async in .forEach)
parent
7565d399
Branches
master
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/mol-geo/representation/structure/units-representation.ts
+6
-3
6 additions, 3 deletions
src/mol-geo/representation/structure/units-representation.ts
with
6 additions
and
3 deletions
src/mol-geo/representation/structure/units-representation.ts
+
6
−
3
View file @
f3353b6e
...
@@ -30,7 +30,7 @@ export function UnitsRepresentation<P extends StructureProps>(label: string, vis
...
@@ -30,7 +30,7 @@ export function UnitsRepresentation<P extends StructureProps>(label: string, vis
function
createOrUpdate
(
props
:
Partial
<
P
>
=
{},
structure
?:
Structure
)
{
function
createOrUpdate
(
props
:
Partial
<
P
>
=
{},
structure
?:
Structure
)
{
_props
=
Object
.
assign
({},
_props
,
props
)
_props
=
Object
.
assign
({},
_props
,
props
)
return
Task
.
create
(
'
Creating or updating
Structure
Representation
'
,
async
ctx
=>
{
return
Task
.
create
(
'
Creating or updating
Units
Representation
'
,
async
ctx
=>
{
if
(
!
_structure
&&
!
structure
)
{
if
(
!
_structure
&&
!
structure
)
{
throw
new
Error
(
'
missing structure
'
)
throw
new
Error
(
'
missing structure
'
)
}
else
if
(
structure
&&
!
_structure
)
{
}
else
if
(
structure
&&
!
_structure
)
{
...
@@ -97,9 +97,12 @@ export function UnitsRepresentation<P extends StructureProps>(label: string, vis
...
@@ -97,9 +97,12 @@ export function UnitsRepresentation<P extends StructureProps>(label: string, vis
}
else
{
}
else
{
// console.log('no new structure')
// console.log('no new structure')
// No new structure given, just update all visuals with new props.
// No new structure given, just update all visuals with new props.
visuals
.
forEach
(
async
({
visual
,
group
})
=>
{
const
visualsList
:
[
UnitsVisual
<
P
>
,
Unit
.
SymmetryGroup
][]
=
[]
// TODO avoid allocation
visuals
.
forEach
(({
visual
,
group
})
=>
visualsList
.
push
([
visual
,
group
]))
for
(
let
i
=
0
,
il
=
visualsList
.
length
;
i
<
il
;
++
i
)
{
const
[
visual
,
group
]
=
visualsList
[
i
]
await
visual
.
createOrUpdate
(
ctx
,
_props
,
{
group
,
structure
:
_structure
})
await
visual
.
createOrUpdate
(
ctx
,
_props
,
{
group
,
structure
:
_structure
})
}
)
}
}
}
if
(
structure
)
_structure
=
structure
if
(
structure
)
_structure
=
structure
});
});
...
...
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