/** * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info. * * @author David Sehnal */ import { PluginCommands } from 'mol-plugin/command'; import * as React from 'react'; import { PluginUIComponent } from './base'; import { ParamDefinition as PD } from 'mol-util/param-definition'; import { ParameterControls } from './controls/parameters'; import { Icon } from './controls/common'; export class CameraSnapshots extends PluginUIComponent<{ }, { }> { render() { return
Camera Snapshots
; } } class CameraSnapshotControls extends PluginUIComponent<{ }, { name: string, description: string }> { static Params = { name: PD.Text(), description: PD.Text() } state = PD.getDefaultValues(CameraSnapshotControls.Params); add = () => { PluginCommands.Camera.Snapshots.Add.dispatch(this.plugin, this.state); this.setState({ name: '', description: '' }) } clear = () => { PluginCommands.Camera.Snapshots.Clear.dispatch(this.plugin, {}); } render() { return
this.setState({ [p.name]: p.value } as any)} />
; } } class CameraSnapshotList extends PluginUIComponent<{ }, { }> { componentDidMount() { this.subscribe(this.plugin.events.state.cameraSnapshots.changed, () => this.forceUpdate()); } apply(id: string) { return () => PluginCommands.Camera.Snapshots.Apply.dispatch(this.plugin, { id }); } remove(id: string) { return () => { PluginCommands.Camera.Snapshots.Remove.dispatch(this.plugin, { id }); } } render() { return ; } }