Skip to content
Snippets Groups Projects
Commit 51fbb619 authored by David Sehnal's avatar David Sehnal
Browse files

UI customization via spec & tweaks

parent 062c4b33
No related branches found
No related tags found
No related merge requests found
...@@ -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 StructureToolsWrapper extends PluginUIComponent { export class DefaultStructureTools 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>; </>;
} }
} }
/** /**
* Copyright (c) 2018-2019 mol* contributors, licensed under MIT, See LICENSE file for more info. * Copyright (c) 2018-2020 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, StructureToolsWrapper } from './controls'; import { LociLabels, TrajectoryViewportControls, StateSnapshotViewportControls, AnimationViewportControls, DefaultStructureTools } 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) || ViewportWrapper; const viewport = this.plugin.spec.components?.viewport || DefaultViewport;
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 ViewportWrapper extends PluginUIComponent { export class DefaultViewport 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>
<ViewportControls /> <VPControls />
<BackgroundTaskProgress /> <BackgroundTaskProgress />
<div className='msp-highlight-toast-wrapper'> <div className='msp-highlight-toast-wrapper'>
<LociLabels /> <LociLabels />
......
...@@ -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>
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment