types.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. import { ExcalidrawTextElement } from "../element/types";
  2. import { AppClassProperties, AppState } from "../types";
  3. export type RenderConfig = {
  4. // AppState values
  5. // ---------------------------------------------------------------------------
  6. scrollX: AppState["scrollX"];
  7. scrollY: AppState["scrollY"];
  8. /** null indicates transparent bg */
  9. viewBackgroundColor: AppState["viewBackgroundColor"] | null;
  10. zoom: AppState["zoom"];
  11. shouldCacheIgnoreZoom: AppState["shouldCacheIgnoreZoom"];
  12. theme: AppState["theme"];
  13. // collab-related state
  14. // ---------------------------------------------------------------------------
  15. remotePointerViewportCoords: { [id: string]: { x: number; y: number } };
  16. remotePointerButton?: { [id: string]: string | undefined };
  17. remoteSelectedElementIds: { [elementId: string]: string[] };
  18. remotePointerUsernames: { [id: string]: string };
  19. remotePointerUserStates: { [id: string]: string };
  20. // extra options passed to the renderer
  21. // ---------------------------------------------------------------------------
  22. imageCache: AppClassProperties["imageCache"];
  23. renderScrollbars?: boolean;
  24. renderSelection?: boolean;
  25. renderGrid?: boolean;
  26. /** when exporting the behavior is slightly different (e.g. we can't use
  27. CSS filters), and we disable render optimizations for best output */
  28. isExporting: boolean;
  29. };
  30. export type SceneScroll = {
  31. scrollX: number;
  32. scrollY: number;
  33. };
  34. export interface Scene {
  35. elements: ExcalidrawTextElement[];
  36. }
  37. export type ExportType =
  38. | "png"
  39. | "clipboard"
  40. | "clipboard-svg"
  41. | "backend"
  42. | "svg";
  43. export type ScrollBars = {
  44. horizontal: {
  45. x: number;
  46. y: number;
  47. width: number;
  48. height: number;
  49. } | null;
  50. vertical: {
  51. x: number;
  52. y: number;
  53. width: number;
  54. height: number;
  55. } | null;
  56. };