index.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132
  1. /**
  2. * Copyright (c) 2018 mol* contributors, licensed under MIT, See LICENSE file for more info.
  3. *
  4. * @author Alexander Rose <alexander.rose@weirdbyte.de>
  5. */
  6. import { Task, RuntimeContext } from 'mol-task'
  7. import { RenderObject } from 'mol-gl/render-object'
  8. import { PickingId } from '../util/picking';
  9. import { Loci } from 'mol-model/loci';
  10. import { MarkerAction } from '../util/marker-data';
  11. export interface RepresentationProps {}
  12. export interface Representation<D, P extends RepresentationProps = {}> {
  13. readonly renderObjects: ReadonlyArray<RenderObject>
  14. readonly props: Readonly<P>
  15. create: (data: D, props?: P) => Task<void>
  16. update: (props: P) => Task<void>
  17. getLoci: (pickingId: PickingId) => Loci
  18. mark: (loci: Loci, action: MarkerAction) => void
  19. destroy: () => void
  20. }
  21. export interface Visual<D, P extends RepresentationProps = {}> {
  22. readonly renderObject: RenderObject
  23. create: (ctx: RuntimeContext, data: D, props: P) => Promise<void>
  24. update: (ctx: RuntimeContext, props: P) => Promise<boolean>
  25. getLoci: (pickingId: PickingId) => Loci
  26. mark: (loci: Loci, action: MarkerAction) => void
  27. destroy: () => void
  28. }