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
c7e6fcce
You need to sign in or sign up before continuing.
Commit
c7e6fcce
authored
6 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
wip: plugin layout
parent
77d2f23e
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/mol-plugin/ui/plugin.tsx
+34
-14
34 additions, 14 deletions
src/mol-plugin/ui/plugin.tsx
src/mol-plugin/ui/viewport.tsx
+10
-1
10 additions, 1 deletion
src/mol-plugin/ui/viewport.tsx
with
44 additions
and
15 deletions
src/mol-plugin/ui/plugin.tsx
+
34
−
14
View file @
c7e6fcce
...
@@ -33,22 +33,42 @@ export class Plugin extends React.Component<{ plugin: PluginContext }, {}> {
...
@@ -33,22 +33,42 @@ export class Plugin extends React.Component<{ plugin: PluginContext }, {}> {
render
()
{
render
()
{
return
<
PluginReactContext
.
Provider
value
=
{
this
.
props
.
plugin
}
>
return
<
PluginReactContext
.
Provider
value
=
{
this
.
props
.
plugin
}
>
<
div
className
=
'msp-plugin'
>
<
Layout
/>
<
div
className
=
'msp-plugin-content msp-layout-expanded'
>
</
PluginReactContext
.
Provider
>;
<
div
className
=
'msp-layout-hide-top'
>
}
{
this
.
region
(
'
main
'
,
<
ViewportWrapper
/>)
}
}
{
this
.
region
(
'
left
'
,
<
State
/>)
}
{
this
.
region
(
'
right
'
,
<
div
className
=
'msp-scrollable-container msp-right-controls'
>
class
Layout
extends
PluginComponent
{
<
CurrentObject
/>
componentDidMount
()
{
<
Controls
/>
this
.
subscribe
(
this
.
plugin
.
layout
.
updated
,
()
=>
this
.
forceUpdate
());
<
CameraSnapshots
/>
}
<
StateSnapshots
/>
</
div
>)
}
region
(
kind
:
'
left
'
|
'
right
'
|
'
bottom
'
|
'
main
'
,
element
:
JSX
.
Element
)
{
{
this
.
region
(
'
bottom
'
,
<
Log
/>)
}
return
<
div
className
=
{
`msp-layout-region msp-layout-
${
kind
}
`
}
>
</
div
>
<
div
className
=
'msp-layout-static'
>
{
element
}
</
div
>
</
div
>;
}
render
()
{
const
showControls
=
this
.
plugin
.
layout
.
latestState
.
showControls
;
return
<
div
className
=
'msp-plugin'
>
<
div
className
=
'msp-plugin-content msp-layout-expanded'
>
<
div
className
=
{
showControls
?
'
msp-layout-hide-top
'
:
'
msp-layout-hide-top msp-layout-hide-right msp-layout-hide-bottom msp-layout-hide-left
'
}
>
{
this
.
region
(
'
main
'
,
<
ViewportWrapper
/>)
}
{
showControls
&&
this
.
region
(
'
left
'
,
<
State
/>)
}
{
showControls
&&
this
.
region
(
'
right
'
,
<
div
className
=
'msp-scrollable-container msp-right-controls'
>
<
CurrentObject
/>
<
Controls
/>
<
CameraSnapshots
/>
<
StateSnapshots
/>
</
div
>)
}
{
showControls
&&
this
.
region
(
'
bottom
'
,
<
Log
/>)
}
</
div
>
</
div
>
</
div
>
</
div
>
</
PluginReactContext
.
Provider
>;
</
div
>;
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/ui/viewport.tsx
+
10
−
1
View file @
c7e6fcce
...
@@ -34,6 +34,10 @@ export class ViewportControls extends PluginComponent {
...
@@ -34,6 +34,10 @@ export class ViewportControls extends PluginComponent {
e
.
currentTarget
.
blur
();
e
.
currentTarget
.
blur
();
}
}
toggleControls
=
()
=>
{
PluginCommands
.
Layout
.
Update
.
dispatch
(
this
.
plugin
,
{
state
:
{
showControls
:
!
this
.
plugin
.
layout
.
latestState
.
showControls
}
});
}
setSettings
=
(
p
:
{
param
:
PD
.
Base
<
any
>
,
name
:
string
,
value
:
any
})
=>
{
setSettings
=
(
p
:
{
param
:
PD
.
Base
<
any
>
,
name
:
string
,
value
:
any
})
=>
{
PluginCommands
.
Canvas3D
.
SetSettings
.
dispatch
(
this
.
plugin
,
{
settings
:
{
[
p
.
name
]:
p
.
value
}
});
PluginCommands
.
Canvas3D
.
SetSettings
.
dispatch
(
this
.
plugin
,
{
settings
:
{
[
p
.
name
]:
p
.
value
}
});
}
}
...
@@ -56,6 +60,7 @@ export class ViewportControls extends PluginComponent {
...
@@ -56,6 +60,7 @@ export class ViewportControls extends PluginComponent {
// TODO: show some icons dimmed etc..
// TODO: show some icons dimmed etc..
return
<
div
className
=
{
'
msp-viewport-controls
'
}
>
return
<
div
className
=
{
'
msp-viewport-controls
'
}
>
<
div
className
=
'msp-viewport-controls-buttons'
>
<
div
className
=
'msp-viewport-controls-buttons'
>
<
button
className
=
'msp-btn msp-btn-link'
onClick
=
{
this
.
toggleControls
}
title
=
'Show/Hide Controls'
><
span
className
=
'msp-icon msp-icon-tools'
/></
button
>
<
button
className
=
'msp-btn msp-btn-link'
onClick
=
{
this
.
toggleSettingsExpanded
}
><
span
className
=
'msp-icon msp-icon-settings'
/></
button
>
<
button
className
=
'msp-btn msp-btn-link'
onClick
=
{
this
.
toggleSettingsExpanded
}
><
span
className
=
'msp-icon msp-icon-settings'
/></
button
>
<
button
className
=
'msp-btn msp-btn-link'
title
=
'Reset Camera'
onClick
=
{
this
.
resetCamera
}
><
span
className
=
'msp-icon msp-icon-reset-scene'
/></
button
>
<
button
className
=
'msp-btn msp-btn-link'
title
=
'Reset Camera'
onClick
=
{
this
.
resetCamera
}
><
span
className
=
'msp-icon msp-icon-reset-scene'
/></
button
>
</
div
>
</
div
>
...
@@ -81,7 +86,7 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
...
@@ -81,7 +86,7 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
};
};
private
handleResize
=
()
=>
{
private
handleResize
=
()
=>
{
this
.
plugin
.
canvas3d
.
handleResize
();
this
.
plugin
.
canvas3d
.
handleResize
();
}
}
componentDidMount
()
{
componentDidMount
()
{
...
@@ -108,6 +113,10 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
...
@@ -108,6 +113,10 @@ export class Viewport extends PluginComponent<{ }, ViewportState> {
if
(
buttons
!==
ButtonsType
.
Flag
.
Primary
)
return
;
if
(
buttons
!==
ButtonsType
.
Flag
.
Primary
)
return
;
idHelper
.
select
(
x
,
y
);
idHelper
.
select
(
x
,
y
);
});
});
this
.
subscribe
(
this
.
plugin
.
layout
.
updated
,
()
=>
{
setTimeout
(
this
.
handleResize
,
50
);
});
}
}
componentWillUnmount
()
{
componentWillUnmount
()
{
...
...
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