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
fdd89495
Commit
fdd89495
authored
Feb 5, 2022
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
fix representation preset side effects
parent
b99026bb
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
CHANGELOG.md
+1
-0
1 addition, 0 deletions
CHANGELOG.md
src/mol-plugin-state/builder/structure/representation-preset.ts
+1
-38
1 addition, 38 deletions
...l-plugin-state/builder/structure/representation-preset.ts
with
2 additions
and
38 deletions
CHANGELOG.md
+
1
−
0
View file @
fdd89495
...
...
@@ -8,6 +8,7 @@ Note that since we don't clearly distinguish between a public and private interf
-
Fix
``xrayShader``
&
``ignoreLight``
params not working at the same time
-
Add
``ignoreLight``
to component params
-
Fix representation preset side effects (changing post-processing parameters, see #363)
## [v3.0.2] - 2022-01-30
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin-state/builder/structure/representation-preset.ts
+
1
−
38
View file @
fdd89495
...
...
@@ -24,8 +24,6 @@ import { IndexPairBonds } from '../../../mol-model-formats/structure/property/bo
import
{
StructConn
}
from
'
../../../mol-model-formats/structure/property/bonds/struct_conn
'
;
import
{
StructureRepresentationRegistry
}
from
'
../../../mol-repr/structure/registry
'
;
import
{
assertUnreachable
}
from
'
../../../mol-util/type-helpers
'
;
import
{
Color
}
from
'
../../../mol-util/color
'
;
import
{
PostprocessingParams
}
from
'
../../../mol-canvas3d/passes/postprocessing
'
;
export
interface
StructureRepresentationPresetProvider
<
P
=
any
,
S
extends
_Result
=
_Result
>
extends
PresetProvider
<
PluginStateObject
.
Molecule
.
Structure
,
P
,
S
>
{
}
export
function
StructureRepresentationPresetProvider
<
P
,
S
extends
_Result
>
(
repr
:
StructureRepresentationPresetProvider
<
P
,
S
>
)
{
return
repr
;
}
...
...
@@ -103,15 +101,6 @@ type CommonParams = StructureRepresentationPresetProvider.CommonParams
const
reprBuilder
=
StructureRepresentationPresetProvider
.
reprBuilder
;
const
updateFocusRepr
=
StructureRepresentationPresetProvider
.
updateFocusRepr
;
function
resetPostprocessingProps
(
plugin
:
PluginContext
)
{
if
(
plugin
.
canvas3d
)
{
const
p
=
PD
.
getDefaultValues
(
PostprocessingParams
);
plugin
.
canvas3d
.
setProps
({
postprocessing
:
{
outline
:
p
.
outline
,
occlusion
:
p
.
occlusion
}
});
}
}
const
auto
=
StructureRepresentationPresetProvider
({
id
:
'
preset-structure-representation-auto
'
,
display
:
{
...
...
@@ -151,7 +140,6 @@ const empty = StructureRepresentationPresetProvider({
id
:
'
preset-structure-representation-empty
'
,
display
:
{
name
:
'
Empty
'
,
description
:
'
Removes all existing representations.
'
},
async
apply
(
ref
,
params
,
plugin
)
{
resetPostprocessingProps
(
plugin
);
return
{
};
}
});
...
...
@@ -206,8 +194,6 @@ const polymerAndLigand = StructureRepresentationPresetProvider({
await
update
.
commit
({
revertOnError
:
false
});
await
updateFocusRepr
(
plugin
,
structure
,
params
.
theme
?.
focus
?.
name
,
params
.
theme
?.
focus
?.
params
);
resetPostprocessingProps
(
plugin
);
return
{
components
,
representations
};
}
});
...
...
@@ -247,8 +233,6 @@ const proteinAndNucleic = StructureRepresentationPresetProvider({
await
update
.
commit
({
revertOnError
:
true
});
await
updateFocusRepr
(
plugin
,
structure
,
params
.
theme
?.
focus
?.
name
,
params
.
theme
?.
focus
?.
params
);
resetPostprocessingProps
(
plugin
);
return
{
components
,
representations
};
}
});
...
...
@@ -301,8 +285,6 @@ const coarseSurface = StructureRepresentationPresetProvider({
await
update
.
commit
({
revertOnError
:
true
});
await
updateFocusRepr
(
plugin
,
structure
,
params
.
theme
?.
focus
?.
name
,
params
.
theme
?.
focus
?.
params
);
resetPostprocessingProps
(
plugin
);
return
{
components
,
representations
};
}
});
...
...
@@ -336,8 +318,6 @@ const polymerCartoon = StructureRepresentationPresetProvider({
await
update
.
commit
({
revertOnError
:
true
});
await
updateFocusRepr
(
plugin
,
structure
,
params
.
theme
?.
focus
?.
name
,
params
.
theme
?.
focus
?.
params
);
resetPostprocessingProps
(
plugin
);
return
{
components
,
representations
};
}
});
...
...
@@ -404,8 +384,6 @@ const atomicDetail = StructureRepresentationPresetProvider({
await
update
.
commit
({
revertOnError
:
true
});
await
updateFocusRepr
(
plugin
,
structure
,
params
.
theme
?.
focus
?.
name
??
color
,
params
.
theme
?.
focus
?.
params
??
colorParams
);
resetPostprocessingProps
(
plugin
);
return
{
components
,
representations
};
}
});
...
...
@@ -439,21 +417,6 @@ const illustrative = StructureRepresentationPresetProvider({
await
update
.
commit
({
revertOnError
:
true
});
await
updateFocusRepr
(
plugin
,
structure
,
params
.
theme
?.
focus
?.
name
??
color
,
params
.
theme
?.
focus
?.
params
);
if
(
plugin
.
canvas3d
)
{
plugin
.
canvas3d
.
setProps
({
postprocessing
:
{
outline
:
{
name
:
'
on
'
,
params
:
{
scale
:
1
,
color
:
Color
(
0x000000
),
threshold
:
0.25
}
},
occlusion
:
{
name
:
'
on
'
,
params
:
{
bias
:
0.9
,
blurKernelSize
:
15
,
radius
:
5
,
samples
:
32
}
},
}
});
}
return
{
components
,
representations
};
}
});
...
...
@@ -474,6 +437,6 @@ export const PresetStructureRepresentations = {
'
polymer-and-ligand
'
:
polymerAndLigand
,
'
protein-and-nucleic
'
:
proteinAndNucleic
,
'
coarse-surface
'
:
coarseSurface
,
'
illustrative
'
:
illustrative
,
illustrative
,
};
export
type
PresetStructureRepresentations
=
typeof
PresetStructureRepresentations
;
\ No newline at end of file
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