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
851b7c62
Commit
851b7c62
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
wip
parent
209e828f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/mol-repr/representation.ts
+13
-3
13 additions, 3 deletions
src/mol-repr/representation.ts
src/mol-repr/structure/complex-representation.ts
+11
-4
11 additions, 4 deletions
src/mol-repr/structure/complex-representation.ts
with
24 additions
and
7 deletions
src/mol-repr/representation.ts
+
13
−
3
View file @
851b7c62
...
...
@@ -67,6 +67,7 @@ interface Representation<D, P extends RepresentationProps = {}> {
readonly
label
:
string
readonly
renderObjects
:
ReadonlyArray
<
RenderObject
>
readonly
props
:
Readonly
<
P
>
readonly
params
:
Readonly
<
PD
.
Params
>
createOrUpdate
:
(
ctx
:
RepresentationContext
,
props
?:
Partial
<
P
>
,
themeProps
?:
ThemeProps
,
data
?:
D
)
=>
Task
<
void
>
getLoci
:
(
pickingId
:
PickingId
)
=>
Loci
mark
:
(
loci
:
Loci
,
action
:
MarkerAction
)
=>
boolean
...
...
@@ -75,7 +76,7 @@ interface Representation<D, P extends RepresentationProps = {}> {
namespace
Representation
{
export
type
Any
=
Representation
<
any
>
export
const
Empty
:
Representation
<
any
>
=
{
label
:
''
,
renderObjects
:
[],
props
:
{},
label
:
''
,
renderObjects
:
[],
props
:
{},
params
:
{},
createOrUpdate
:
()
=>
Task
.
constant
(
''
,
undefined
),
getLoci
:
()
=>
EmptyLoci
,
mark
:
()
=>
false
,
...
...
@@ -84,8 +85,9 @@ namespace Representation {
export
type
Def
<
P
extends
RepresentationProps
=
{}
>
=
{
[
k
:
string
]:
(
defaultProps
:
P
)
=>
Representation
<
any
,
P
>
}
export
function
createMulti
<
D
,
P
extends
RepresentationProps
=
{}
>
(
label
:
string
,
defaultProps
:
P
,
reprDefs
:
Def
<
P
>
):
Representation
<
D
,
P
>
{
let
currentProps
:
P
=
Object
.
assign
({},
defaultProps
)
export
function
createMulti
<
D
,
P
extends
RepresentationProps
=
{}
>
(
label
:
string
,
getParams
:
(
ctx
:
ThemeRegistryContext
,
data
:
D
)
=>
PD
.
Params
,
reprDefs
:
Def
<
P
>
):
Representation
<
D
,
P
>
{
let
currentParams
:
PD
.
Params
let
currentProps
:
P
let
currentData
:
D
const
reprMap
:
{
[
k
:
number
]:
string
}
=
{}
...
...
@@ -111,8 +113,16 @@ namespace Representation {
reprList
.
forEach
(
r
=>
Object
.
assign
(
props
,
r
.
props
))
return
props
as
P
},
get
params
()
{
return
currentParams
},
createOrUpdate
:
(
ctx
:
RepresentationContext
,
props
:
Partial
<
P
>
=
{},
themeProps
:
ThemeProps
=
{},
data
?:
D
)
=>
{
if
(
data
)
currentData
=
data
if
(
data
&&
data
!==
currentData
)
{
currentParams
=
getParams
(
ctx
,
data
)
currentData
=
data
if
(
!
currentProps
)
currentProps
=
PD
.
getDefaultValues
(
currentParams
)
as
P
}
const
qualityProps
=
getQualityProps
(
Object
.
assign
({},
currentProps
,
props
),
currentData
)
Object
.
assign
(
currentProps
,
props
,
qualityProps
)
...
...
This diff is collapsed.
Click to expand it.
src/mol-repr/structure/complex-representation.ts
+
11
−
4
View file @
851b7c62
...
...
@@ -13,17 +13,23 @@ import { ComplexVisual } from './complex-visual';
import
{
PickingId
}
from
'
mol-geo/geometry/picking
'
;
import
{
MarkerAction
}
from
'
mol-geo/geometry/marker-data
'
;
import
{
RepresentationContext
}
from
'
mol-repr/representation
'
;
import
{
Theme
,
ThemeProps
,
createTheme
}
from
'
mol-theme/theme
'
;
import
{
Theme
,
ThemeProps
,
createTheme
,
ThemeRegistryContext
}
from
'
mol-theme/theme
'
;
import
{
ParamDefinition
as
PD
}
from
'
mol-util/param-definition
'
;
export
function
ComplexRepresentation
<
P
extends
StructureProps
>
(
label
:
string
,
defaultProps
:
P
,
visualCtor
:
()
=>
ComplexVisual
<
P
>
):
StructureRepresentation
<
P
>
{
export
function
ComplexRepresentation
<
P
extends
StructureProps
>
(
label
:
string
,
getParams
:
(
ctx
:
ThemeRegistryContext
,
data
:
Structure
)
=>
PD
.
Params
,
visualCtor
:
()
=>
ComplexVisual
<
P
>
):
StructureRepresentation
<
P
>
{
let
visual
:
ComplexVisual
<
P
>
|
undefined
let
_structure
:
Structure
let
_props
:
P
=
Object
.
assign
({},
defaultProps
)
let
_params
:
PD
.
Params
let
_props
:
P
let
_theme
:
Theme
function
createOrUpdate
(
ctx
:
RepresentationContext
,
props
:
Partial
<
P
>
=
{},
themeProps
:
ThemeProps
=
{},
structure
?:
Structure
)
{
if
(
structure
)
_structure
=
structure
if
(
structure
&&
structure
!==
_structure
)
{
_params
=
getParams
(
ctx
,
structure
)
_structure
=
structure
if
(
!
_props
)
_props
=
PD
.
getDefaultValues
(
_params
)
as
P
}
_props
=
Object
.
assign
({},
_props
,
props
)
_theme
=
createTheme
(
ctx
,
{
structure
:
_structure
},
props
,
themeProps
,
_theme
)
...
...
@@ -51,6 +57,7 @@ export function ComplexRepresentation<P extends StructureProps>(label: string, d
return
visual
&&
visual
.
renderObject
?
[
visual
.
renderObject
]
:
[]
},
get
props
()
{
return
_props
},
get
params
()
{
return
_params
},
createOrUpdate
,
getLoci
,
mark
,
...
...
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