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
883c1b02
Commit
883c1b02
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
better defaultParam handling
parent
c0250539
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/mol-plugin/state/transforms/representation.ts
+8
-8
8 additions, 8 deletions
src/mol-plugin/state/transforms/representation.ts
src/mol-theme/color.ts
+3
-3
3 additions, 3 deletions
src/mol-theme/color.ts
src/mol-theme/size.ts
+5
-5
5 additions, 5 deletions
src/mol-theme/size.ts
with
16 additions
and
16 deletions
src/mol-plugin/state/transforms/representation.ts
+
8
−
8
View file @
883c1b02
...
...
@@ -14,31 +14,31 @@ import { ParamDefinition as PD } from 'mol-util/param-definition';
import
{
createTheme
}
from
'
mol-theme/theme
'
;
import
{
BuiltInStructureRepresentationsName
}
from
'
mol-repr/structure/registry
'
;
import
{
Structure
}
from
'
mol-model/structure
'
;
import
{
UnitsMesh
Params
}
from
'
mol-repr/structure/
units-visual
'
;
import
{
Structure
Params
}
from
'
mol-repr/structure/
representation
'
;
export
namespace
StructureRepresentation3DHelpers
{
export
function
getDefaultParams
(
ctx
:
PluginContext
,
name
:
BuiltInStructureRepresentationsName
,
structure
:
Structure
,
mesh
Params
?:
Partial
<
PD
.
Values
<
UnitsMesh
Params
>>
):
Transformer
.
Params
<
StructureRepresentation3D
>
{
export
function
getDefaultParams
(
ctx
:
PluginContext
,
name
:
BuiltInStructureRepresentationsName
,
structure
:
Structure
,
structure
Params
?:
Partial
<
PD
.
Values
<
Structure
Params
>>
):
Transformer
.
Params
<
StructureRepresentation3D
>
{
const
type
=
ctx
.
structureRepresentation
.
registry
.
get
(
name
);
const
themeDataCtx
=
{
structure
};
const
colorParams
=
ctx
.
structureRepresentation
.
themeCtx
.
colorThemeRegistry
.
get
(
type
.
defaultColorTheme
).
getParams
(
themeDataCtx
);
const
sizeParams
=
ctx
.
structureRepresentation
.
themeCtx
.
sizeThemeRegistry
.
get
(
type
.
defaultSizeTheme
).
getParams
(
themeDataCtx
)
const
structureDefaultParams
=
PD
.
getDefaultValues
(
type
.
getParams
(
ctx
.
structureRepresentation
.
themeCtx
,
structure
))
return
({
type
:
{
name
,
params
:
mesh
Params
?
{
...
type
.
d
efault
Value
s
,
...
mesh
Params
}
:
type
.
d
efault
Value
s
},
type
:
{
name
,
params
:
structure
Params
?
{
...
structureD
efault
Param
s
,
...
structure
Params
}
:
structureD
efault
Param
s
},
colorTheme
:
{
name
:
type
.
defaultColorTheme
,
params
:
PD
.
getDefaultValues
(
colorParams
)
},
sizeTheme
:
{
name
:
type
.
defaultSizeTheme
,
params
:
PD
.
getDefaultValues
(
sizeParams
)
}
})
}
export
function
getDefaultParamsStatic
(
ctx
:
PluginContext
,
name
:
BuiltInStructureRepresentationsName
,
mesh
Params
?:
Partial
<
PD
.
Values
<
UnitsMesh
Params
>>
):
Transformer
.
Params
<
StructureRepresentation3D
>
{
export
function
getDefaultParamsStatic
(
ctx
:
PluginContext
,
name
:
BuiltInStructureRepresentationsName
,
structure
Params
?:
Partial
<
PD
.
Values
<
Structure
Params
>>
):
Transformer
.
Params
<
StructureRepresentation3D
>
{
const
type
=
ctx
.
structureRepresentation
.
registry
.
get
(
name
);
const
colorParams
=
ctx
.
structureRepresentation
.
themeCtx
.
colorThemeRegistry
.
get
(
type
.
defaultColorTheme
).
defaultValues
;
const
sizeParams
=
ctx
.
structureRepresentation
.
themeCtx
.
sizeThemeRegistry
.
get
(
type
.
defaultSizeTheme
).
defaultValues
return
({
type
:
{
name
,
params
:
mesh
Params
?
{
...
type
.
defaultValues
,
...
mesh
Params
}
:
type
.
defaultValues
},
colorTheme
:
{
name
:
type
.
defaultColorTheme
,
params
:
PD
.
getDefaultValues
(
colorParams
)
},
sizeTheme
:
{
name
:
type
.
defaultSizeTheme
,
params
:
PD
.
getDefaultValues
(
sizeParams
)
}
type
:
{
name
,
params
:
structure
Params
?
{
...
type
.
defaultValues
,
...
structure
Params
}
:
type
.
defaultValues
},
colorTheme
:
{
name
:
type
.
defaultColorTheme
,
params
:
colorParams
},
sizeTheme
:
{
name
:
type
.
defaultSizeTheme
,
params
:
sizeParams
}
})
}
}
...
...
This diff is collapsed.
Click to expand it.
src/mol-theme/color.ts
+
3
−
3
View file @
883c1b02
...
...
@@ -89,9 +89,9 @@ namespace ColorTheme {
return
this
.
_map
.
get
(
name
)
||
EmptyProvider
as
unknown
as
Provider
<
P
>
}
create
(
id
:
string
,
ctx
:
ThemeDataContext
,
props
=
{})
{
const
provider
=
this
.
get
(
id
)
return
provider
?
provider
.
factory
(
ctx
,
{
...
PD
.
getDefaultValues
(
provider
.
getParams
(
ctx
)),
...
props
})
:
Empty
create
(
name
:
string
,
ctx
:
ThemeDataContext
,
props
=
{})
{
const
provider
=
this
.
get
(
name
)
return
provider
.
factory
(
ctx
,
{
...
PD
.
getDefaultValues
(
provider
.
getParams
(
ctx
)),
...
props
})
}
get
list
()
{
...
...
This diff is collapsed.
Click to expand it.
src/mol-theme/size.ts
+
5
−
5
View file @
883c1b02
...
...
@@ -63,13 +63,13 @@ namespace SizeTheme {
this
.
_map
.
delete
(
name
)
}
get
<
P
extends
PD
.
Params
>
(
id
:
string
)
{
return
this
.
_map
.
get
(
id
)
||
EmptyProvider
as
unknown
as
Provider
<
P
>
get
<
P
extends
PD
.
Params
>
(
name
:
string
)
:
Provider
<
P
>
{
return
this
.
_map
.
get
(
name
)
||
EmptyProvider
as
unknown
as
Provider
<
P
>
}
create
(
id
:
string
,
ctx
:
ThemeDataContext
,
props
=
{})
{
const
provider
=
this
.
get
(
id
)
return
provider
?
provider
.
factory
(
ctx
,
{
...
PD
.
getDefaultValues
(
provider
.
getParams
(
ctx
)),
...
props
})
:
Empty
create
(
name
:
string
,
ctx
:
ThemeDataContext
,
props
=
{})
{
const
provider
=
this
.
get
(
name
)
return
provider
.
factory
(
ctx
,
{
...
PD
.
getDefaultValues
(
provider
.
getParams
(
ctx
)),
...
props
})
}
get
list
()
{
...
...
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