Parcourir la source

fix: export grouped elements

Konstantinos Kaloutas il y a 2 ans
Parent
commit
c204bce3d4
1 fichiers modifiés avec 5 ajouts et 1 suppressions
  1. 5 1
      tldraw/packages/react/src/components/Shape/Shape.tsx

+ 5 - 1
tldraw/packages/react/src/components/Shape/Shape.tsx

@@ -38,10 +38,14 @@ export const Shape = observer(function Shape({
   } = shape
   const app = useApp<Shape>()
   const events = useShapeEvents(shape)
+  const parentGroup = app.getParentGroup(shape)
+  const isParentGrpupSelected = app.selectedIds.has(parentGroup?.id)
+  const ignoreExport = !isSelected && !isParentGrpupSelected && app.selectedShapes.size !== 0 || null
+
   return (
     <Container
       data-shape-id={shape.id}
-      data-html2canvas-ignore={(!isSelected && app.selectedShapes.size !== 0) || null}
+      data-html2canvas-ignore={ignoreExport}
       zIndex={zIndex}
       data-type="Shape"
       bounds={bounds}