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
5ad983e9
Commit
5ad983e9
authored
6 years ago
by
Alexander Rose
Browse files
Options
Downloads
Patches
Plain Diff
canvas ui weaks
parent
acd59b65
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/apps/canvas/component/representation.tsx
+28
-6
28 additions, 6 deletions
src/apps/canvas/component/representation.tsx
src/mol-app/component/color-theme.tsx
+2
-2
2 additions, 2 deletions
src/mol-app/component/color-theme.tsx
with
30 additions
and
8 deletions
src/apps/canvas/component/representation.tsx
+
28
−
6
View file @
5ad983e9
...
...
@@ -11,6 +11,9 @@ import { Params } from 'mol-view/parameter';
import
{
Representation
}
from
'
mol-geo/representation
'
;
import
{
ParametersComponent
}
from
'
mol-app/component/parameters
'
;
import
{
Progress
}
from
'
mol-task
'
;
import
{
ColorTheme
}
from
'
mol-view/theme/color
'
;
import
{
getColorThemeProps
}
from
'
mol-geo/geometry/color-data
'
;
import
{
ColorThemeComponent
}
from
'
mol-app/component/color-theme
'
;
export
interface
RepresentationComponentProps
{
app
:
App
...
...
@@ -19,34 +22,53 @@ export interface RepresentationComponentProps {
}
export
interface
RepresentationComponentState
{
label
:
string
reprParams
:
Params
reprProps
:
Readonly
<
{}
>
}
export
class
RepresentationComponent
extends
React
.
Component
<
RepresentationComponentProps
,
RepresentationComponentState
>
{
private
stateFromRepr
(
repr
:
Representation
<
Params
>
)
{
return
{
label
:
this
.
props
.
repr
.
label
,
reprParams
:
this
.
props
.
repr
.
params
,
reprProps
:
this
.
props
.
repr
.
props
}
}
componentWillMount
()
{
this
.
setState
(
this
.
stateFromRepr
(
this
.
props
.
repr
))
}
async
onChange
(
k
:
string
,
v
:
any
)
{
await
this
.
props
.
app
.
runTask
(
this
.
props
.
repr
.
createOrUpdate
({
[
k
]:
v
}).
run
(
progress
=>
console
.
log
(
Progress
.
format
(
progress
))
),
'
Representation Update
'
)
this
.
props
.
viewer
.
add
(
this
.
props
.
repr
)
this
.
props
.
viewer
.
requestDraw
(
true
)
this
.
setState
(
this
.
stateFromRepr
(
this
.
props
.
repr
))
}
render
()
{
const
{
repr
}
=
this
.
props
// const ct = ColorTheme(colorTheme)
const
{
label
,
reprParams
,
reprProps
}
=
this
.
state
let
colorTheme
:
ColorTheme
|
undefined
=
undefined
if
(
'
colorTheme
'
in
reprProps
)
{
colorTheme
=
ColorTheme
(
getColorThemeProps
(
reprProps
))
}
return
<
div
>
<
div
>
<
h4
>
{
repr
.
label
}
</
h4
>
<
h4
>
{
label
}
</
h4
>
</
div
>
<
div
>
<
ParametersComponent
params
=
{
repr
.
p
arams
}
values
=
{
repr
.
p
rops
}
params
=
{
repr
P
arams
}
values
=
{
repr
P
rops
}
onChange
=
{
(
k
,
v
)
=>
this
.
onChange
(
k
as
string
,
v
)
}
/>
</
div
>
{
colorTheme
!==
undefined
?
<
ColorThemeComponent
colorTheme
=
{
colorTheme
}
/>
:
''
}
</
div
>;
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/mol-app/component/color-theme.tsx
+
2
−
2
View file @
5ad983e9
...
...
@@ -13,12 +13,12 @@ export interface ColorThemeComponentProps {
}
export
interface
ColorThemeComponentState
{
}
export
class
ColorThemeComponent
extends
React
.
Component
<
ColorThemeComponentProps
,
ColorThemeComponentState
>
{
state
=
{
}
render
()
{
...
...
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