Skip to content
Snippets Groups Projects
controls.tsx 1.34 KiB
Newer Older
David Sehnal's avatar
David Sehnal committed
/**
 * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
 *
 * @author David Sehnal <david.sehnal@gmail.com>
 */

import * as React from 'react';
David Sehnal's avatar
David Sehnal committed
import { PluginCommands } from 'mol-plugin/command';
import { UpdateTrajectory } from 'mol-plugin/state/actions/basic';
import { PluginComponent } from './base';
export class Controls extends PluginComponent<{ }, { }> {
David Sehnal's avatar
David Sehnal committed
    render() {
David Sehnal's avatar
David Sehnal committed
        return <>

        </>;
David Sehnal's avatar
David Sehnal committed
}

export class TrajectoryControls extends PluginComponent {
David Sehnal's avatar
David Sehnal committed
    render() {
        return <div>
            <b>Trajectory: </b>
David Sehnal's avatar
David Sehnal committed
            <button onClick={() => PluginCommands.State.ApplyAction.dispatch(this.plugin, {
                state: this.plugin.state.dataState,
David Sehnal's avatar
David Sehnal committed
                action: UpdateTrajectory.create({ action: 'advance', by: -1 })
            })}>&lt;&lt;</button>
David Sehnal's avatar
David Sehnal committed
            <button onClick={() => PluginCommands.State.ApplyAction.dispatch(this.plugin, {
                state: this.plugin.state.dataState,
David Sehnal's avatar
David Sehnal committed
                action: UpdateTrajectory.create({ action: 'reset' })
            })}>Reset</button>
David Sehnal's avatar
David Sehnal committed
            <button onClick={() => PluginCommands.State.ApplyAction.dispatch(this.plugin, {
                state: this.plugin.state.dataState,
David Sehnal's avatar
David Sehnal committed
                action: UpdateTrajectory.create({ action: 'advance', by: +1 })
            })}>&gt;&gt;</button><br />
        </div>
    }