From e4749a5c470f85f75f737218eeef8c88fec10e77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mitja=20Bezen=C5=A1ek?= Date: Wed, 27 Mar 2024 09:15:39 +0100 Subject: [PATCH] WIP --- packages/editor/src/lib/components/Shape.tsx | 40 +++----------------- 1 file changed, 6 insertions(+), 34 deletions(-) diff --git a/packages/editor/src/lib/components/Shape.tsx b/packages/editor/src/lib/components/Shape.tsx index 3762290b3..87acb640e 100644 --- a/packages/editor/src/lib/components/Shape.tsx +++ b/packages/editor/src/lib/components/Shape.tsx @@ -1,12 +1,10 @@ import { useQuickReactor, useStateTracking } from '@tldraw/state' -import { IdOf } from '@tldraw/store' import { TLShape, TLShapeId } from '@tldraw/tlschema' import { memo, useCallback, useRef } from 'react' import { ShapeUtil } from '../editor/shapes/ShapeUtil' import { useEditor } from '../hooks/useEditor' import { useEditorComponents } from '../hooks/useEditorComponents' import { Mat } from '../primitives/Mat' -import { toDomPrecision } from '../primitives/utils' import { setStyleProperty } from '../utils/dom' import { OptionalErrorBoundary } from './ErrorBoundary' @@ -133,21 +131,15 @@ export const Shape = memo(function Shape({ data-shape-type={shape.type} draggable={false} > - {isCulled ? null : ( - - - - )} + + + )}
- {isCulled ? ( - - ) : ( - - - - )} + + +
) @@ -172,23 +164,3 @@ const InnerShapeBackground = memo( }, (prev, next) => prev.shape.props === next.shape.props && prev.shape.meta === next.shape.meta ) - -const CulledShape = function CulledShape({ shapeId }: { shapeId: IdOf }) { - const editor = useEditor() - const culledRef = useRef(null) - - useQuickReactor( - 'set shape stuff', - () => { - const bounds = editor.getShapeGeometry(shapeId).bounds - setStyleProperty( - culledRef.current, - 'transform', - `translate(${toDomPrecision(bounds.minX)}px, ${toDomPrecision(bounds.minY)}px)` - ) - }, - [editor] - ) - - return
-}