From b75274be88a6c1a6f81edb706fc14e37d2df6e77 Mon Sep 17 00:00:00 2001 From: raigo132 Date: Thu, 1 Jun 2023 10:10:29 +0300 Subject: [PATCH] feat: allow exhibit component to capture the canvas image --- src/components/Exhibit/Exhibit.component.tsx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/components/Exhibit/Exhibit.component.tsx b/src/components/Exhibit/Exhibit.component.tsx index a4a86e9d..739de010 100644 --- a/src/components/Exhibit/Exhibit.component.tsx +++ b/src/components/Exhibit/Exhibit.component.tsx @@ -7,6 +7,7 @@ import { FloatingModel } from 'src/components/Models/FloatingModel'; import { StaticModel } from 'src/components/Models/StaticModel'; import { BoundsModel } from 'src/components/Models/BoundsModel'; import { BaseCanvas } from '../BaseCanvas'; +import Capture, { CaptureType } from '../Capture/Capture.component'; export interface ExhibitProps extends CameraProps, EnvironmentProps { /** @@ -37,6 +38,10 @@ export interface ExhibitProps extends CameraProps, EnvironmentProps { * Enables model to fit to available canvas dimensions. */ fit?: boolean; + /** + * Return base64 image after making screenshot of the canvas. + */ + capture?: CaptureType; } /** @@ -51,7 +56,8 @@ export const Exhibit: FC = ({ className, shadows = false, float = false, - fit = false + fit = false, + capture }) => { const model = useMemo(() => { if (!isValidGlbFormat(modelSrc)) { @@ -99,6 +105,7 @@ export const Exhibit: FC = ({ )} + {capture && } ); };