controls.tsx 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author David Sehnal <david.sehnal@gmail.com>
  5. */
  6. import * as React from 'react';
  7. import { PluginCommands } from 'mol-plugin/command';
  8. import { UpdateTrajectory } from 'mol-plugin/state/actions/basic';
  9. import { PluginComponent } from './base';
  10. export class Controls extends PluginComponent<{ }, { }> {
  11. render() {
  12. return <>
  13. </>;
  14. }
  15. }
  16. export class TrajectoryControls extends PluginComponent {
  17. render() {
  18. return <div>
  19. <b>Trajectory: </b>
  20. <button onClick={() => PluginCommands.State.ApplyAction.dispatch(this.plugin, {
  21. state: this.plugin.state.dataState,
  22. action: UpdateTrajectory.create({ action: 'advance', by: -1 })
  23. })}>&lt;&lt;</button>
  24. <button onClick={() => PluginCommands.State.ApplyAction.dispatch(this.plugin, {
  25. state: this.plugin.state.dataState,
  26. action: UpdateTrajectory.create({ action: 'reset' })
  27. })}>Reset</button>
  28. <button onClick={() => PluginCommands.State.ApplyAction.dispatch(this.plugin, {
  29. state: this.plugin.state.dataState,
  30. action: UpdateTrajectory.create({ action: 'advance', by: +1 })
  31. })}>&gt;&gt;</button><br />
  32. </div>
  33. }
  34. }