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
51fbb619
Commit
51fbb619
authored
5 years ago
by
David Sehnal
Browse files
Options
Downloads
Patches
Plain Diff
UI customization via spec & tweaks
parent
062c4b33
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-ui/controls.tsx
+5
-4
5 additions, 4 deletions
src/mol-plugin-ui/controls.tsx
src/mol-plugin-ui/plugin.tsx
+10
-9
10 additions, 9 deletions
src/mol-plugin-ui/plugin.tsx
src/mol-plugin/spec.ts
+4
-2
4 additions, 2 deletions
src/mol-plugin/spec.ts
with
19 additions
and
15 deletions
src/mol-plugin-ui/controls.tsx
+
5
−
4
View file @
51fbb619
...
@@ -45,6 +45,7 @@ export class TrajectoryViewportControls extends PluginUIComponent<{}, { show: bo
...
@@ -45,6 +45,7 @@ export class TrajectoryViewportControls extends PluginUIComponent<{}, { show: bo
if
(
parents
.
has
(
m
.
sourceRef
))
{
if
(
parents
.
has
(
m
.
sourceRef
))
{
// do not show the controls if there are 2 models of the same trajectory present
// do not show the controls if there are 2 models of the same trajectory present
this
.
setState
({
show
:
false
});
this
.
setState
({
show
:
false
});
return
;
}
}
parents
.
add
(
m
.
sourceRef
);
parents
.
add
(
m
.
sourceRef
);
...
@@ -262,15 +263,15 @@ export class LociLabels extends PluginUIComponent<{}, { entries: ReadonlyArray<L
...
@@ -262,15 +263,15 @@ export class LociLabels extends PluginUIComponent<{}, { entries: ReadonlyArray<L
}
}
}
}
export
class
StructureTools
Wrapper
extends
PluginUIComponent
{
export
class
Default
StructureTools
extends
PluginUIComponent
{
render
()
{
render
()
{
return
<
div
>
return
<>
<
div
className
=
'msp-section-header'
><
Icon
name
=
'
code
'
/>
Structure Tools
</
div
>
<
div
className
=
'msp-section-header'
><
Icon
name
=
'
tools
'
/>
Structure Tools
</
div
>
<
StructureSourceControls
/>
<
StructureSourceControls
/>
<
StructureSelectionControls
/>
<
StructureSelectionControls
/>
<
StructureComponentControls
/>
<
StructureComponentControls
/>
<
StructureMeasurementsControls
/>
<
StructureMeasurementsControls
/>
</
div
>;
</>;
}
}
}
}
This diff is collapsed.
Click to expand it.
src/mol-plugin-ui/plugin.tsx
+
10
−
9
View file @
51fbb619
/**
/**
* Copyright (c) 2018-20
19
mol* contributors, licensed under MIT, See LICENSE file for more info.
* Copyright (c) 2018-20
20
mol* contributors, licensed under MIT, See LICENSE file for more info.
*
*
* @author David Sehnal <david.sehnal@gmail.com>
* @author David Sehnal <david.sehnal@gmail.com>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
* @author Alexander Rose <alexander.rose@weirdbyte.de>
...
@@ -11,7 +11,7 @@ import { LogEntry } from '../mol-util/log-entry';
...
@@ -11,7 +11,7 @@ import { LogEntry } from '../mol-util/log-entry';
import
*
as
React
from
'
react
'
;
import
*
as
React
from
'
react
'
;
import
{
PluginContext
}
from
'
../mol-plugin/context
'
;
import
{
PluginContext
}
from
'
../mol-plugin/context
'
;
import
{
PluginReactContext
,
PluginUIComponent
}
from
'
./base
'
;
import
{
PluginReactContext
,
PluginUIComponent
}
from
'
./base
'
;
import
{
LociLabels
,
TrajectoryViewportControls
,
StateSnapshotViewportControls
,
AnimationViewportControls
,
StructureTools
Wrapper
}
from
'
./controls
'
;
import
{
LociLabels
,
TrajectoryViewportControls
,
StateSnapshotViewportControls
,
AnimationViewportControls
,
Default
StructureTools
}
from
'
./controls
'
;
import
{
StateObjectActionSelect
}
from
'
./state/actions
'
;
import
{
StateObjectActionSelect
}
from
'
./state/actions
'
;
import
{
BackgroundTaskProgress
}
from
'
./task
'
;
import
{
BackgroundTaskProgress
}
from
'
./task
'
;
import
{
Viewport
,
ViewportControls
}
from
'
./viewport
'
;
import
{
Viewport
,
ViewportControls
}
from
'
./viewport
'
;
...
@@ -105,8 +105,8 @@ class Layout extends PluginUIComponent {
...
@@ -105,8 +105,8 @@ class Layout extends PluginUIComponent {
render
()
{
render
()
{
const
layout
=
this
.
plugin
.
layout
.
state
;
const
layout
=
this
.
plugin
.
layout
.
state
;
const
controls
=
(
this
.
plugin
.
spec
.
layout
&&
this
.
plugin
.
spec
.
layout
.
controls
)
||
{
};
const
controls
=
this
.
plugin
.
spec
.
layout
?
.
controls
||
{
};
const
viewport
=
(
this
.
plugin
.
spec
.
layout
&&
this
.
plugin
.
spec
.
layout
.
viewport
)
||
Viewport
Wrapper
;
const
viewport
=
this
.
plugin
.
spec
.
components
?
.
viewport
||
Default
Viewport
;
return
<
div
className
=
'msp-plugin'
>
return
<
div
className
=
'msp-plugin'
>
<
div
className
=
{
this
.
layoutClassName
}
>
<
div
className
=
{
this
.
layoutClassName
}
>
...
@@ -124,17 +124,18 @@ class Layout extends PluginUIComponent {
...
@@ -124,17 +124,18 @@ class Layout extends PluginUIComponent {
export
class
ControlsWrapper
extends
PluginUIComponent
{
export
class
ControlsWrapper
extends
PluginUIComponent
{
render
()
{
render
()
{
const
StructureTools
=
this
.
plugin
.
spec
.
components
?.
structureTools
||
DefaultStructureTools
;
return
<
div
className
=
'msp-scrollable-container'
>
return
<
div
className
=
'msp-scrollable-container'
>
<
CurrentObject
/>
<
CurrentObject
/>
{
/* <AnimationControlsWrapper /> */
}
<
StructureTools
/>
{
/* <CameraSnapshots /> */
}
<
StructureToolsWrapper
/>
</
div
>;
</
div
>;
}
}
}
}
export
class
Viewport
Wrapper
extends
PluginUIComponent
{
export
class
Default
Viewport
extends
PluginUIComponent
{
render
()
{
render
()
{
const
VPControls
=
this
.
plugin
.
spec
.
components
?.
viewportControls
||
ViewportControls
;
return
<>
return
<>
<
Viewport
/>
<
Viewport
/>
<
div
className
=
'msp-viewport-top-left-controls'
>
<
div
className
=
'msp-viewport-top-left-controls'
>
...
@@ -142,7 +143,7 @@ export class ViewportWrapper extends PluginUIComponent {
...
@@ -142,7 +143,7 @@ export class ViewportWrapper extends PluginUIComponent {
<
TrajectoryViewportControls
/>
<
TrajectoryViewportControls
/>
<
StateSnapshotViewportControls
/>
<
StateSnapshotViewportControls
/>
</
div
>
</
div
>
<
V
iewport
Controls
/>
<
V
P
Controls
/>
<
BackgroundTaskProgress
/>
<
BackgroundTaskProgress
/>
<
div
className
=
'msp-highlight-toast-wrapper'
>
<
div
className
=
'msp-highlight-toast-wrapper'
>
<
LociLabels
/>
<
LociLabels
/>
...
...
This diff is collapsed.
Click to expand it.
src/mol-plugin/spec.ts
+
4
−
2
View file @
51fbb619
...
@@ -22,10 +22,12 @@ interface PluginSpec {
...
@@ -22,10 +22,12 @@ interface PluginSpec {
layout
?:
{
layout
?:
{
initial
?:
Partial
<
PluginLayoutStateProps
>
,
initial
?:
Partial
<
PluginLayoutStateProps
>
,
controls
?:
PluginSpec
.
LayoutControls
controls
?:
PluginSpec
.
LayoutControls
viewport
?:
React
.
ComponentClass
},
},
components
?:
{
components
?:
{
remoteState
?:
'
none
'
|
'
default
'
remoteState
?:
'
none
'
|
'
default
'
,
structureTools
?:
React
.
ComponentClass
,
viewport
?:
React
.
ComponentClass
,
viewportControls
?:
React
.
ComponentClass
},
},
config
?:
Map
<
PluginConfigItem
,
unknown
>
config
?:
Map
<
PluginConfigItem
,
unknown
>
}
}
...
...
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