11import React from 'react' ;
22import ShapeRenderer from '../GeometryCanvas/ShapeRenderer' ;
33import PreviewShape from '../GeometryCanvas/PreviewShape' ;
4- import { AnyShape , Point , OperationMode , ShapeType , MeasurementUnit } from '@/types/shapes' ;
4+ import { AnyShape , Point , OperationMode , ShapeType } from '@/types/shapes' ;
55import { Z_INDEX } from '@/utils/constants' ;
66
77interface ShapeLayersProps {
88 scaledShapes : AnyShape [ ] ;
99 selectedShapeId : string | null ;
1010 activeMode : OperationMode ;
1111 isNonInteractive : boolean ;
12- zoomedPixelsPerUnit : number ;
13- measurementUnit : MeasurementUnit ;
1412 onShapeSelect : ( id : string ) => void ;
1513 // Drawing state
1614 isDrawing : boolean ;
1715 drawStart : Point | null ;
1816 drawCurrent : Point | null ;
1917 activeShapeType : ShapeType ;
20- // Event handlers
21- onMouseDown ?: ( e : React . MouseEvent , shapeId : string ) => void ;
22- onMouseMove ?: ( e : React . MouseEvent , shapeId : string ) => void ;
23- onMouseUp ?: ( e : React . MouseEvent , shapeId : string ) => void ;
24- onResizeStart ?: ( e : React . MouseEvent , shapeId : string ) => void ;
25- onRotateStart ?: ( e : React . MouseEvent , shapeId : string ) => void ;
2618}
2719
2820/**
@@ -33,18 +25,11 @@ const ShapeLayers: React.FC<ShapeLayersProps> = React.memo(({
3325 selectedShapeId,
3426 activeMode,
3527 isNonInteractive,
36- zoomedPixelsPerUnit,
37- measurementUnit,
3828 onShapeSelect,
3929 isDrawing,
4030 drawStart,
4131 drawCurrent,
4232 activeShapeType,
43- onMouseDown,
44- onMouseMove,
45- onMouseUp,
46- onResizeStart,
47- onRotateStart,
4833} ) => {
4934 return (
5035 < >
@@ -60,26 +45,20 @@ const ShapeLayers: React.FC<ShapeLayersProps> = React.memo(({
6045 >
6146 < ShapeRenderer
6247 shape = { shape }
63- selected = { selectedShapeId === shape . id }
64- measurementUnit = { measurementUnit }
65- pixelsPerUnit = { zoomedPixelsPerUnit }
66- onMouseDown = { onMouseDown ? ( e ) => onMouseDown ( e , shape . id ) : undefined }
67- onMouseMove = { onMouseMove ? ( e ) => onMouseMove ( e , shape . id ) : undefined }
68- onMouseUp = { onMouseUp ? ( e ) => onMouseUp ( e , shape . id ) : undefined }
69- onResizeStart = { onResizeStart ? ( e ) => onResizeStart ( e , shape . id ) : undefined }
70- onRotateStart = { onRotateStart ? ( e ) => onRotateStart ( e , shape . id ) : undefined }
48+ isSelected = { selectedShapeId === shape . id }
49+ activeMode = { activeMode }
7150 />
7251 </ div >
7352 ) ) }
7453
7554 { /* Preview shape while drawing */ }
76- { isDrawing && drawStart && drawCurrent && activeMode === 'draw' && (
55+ { isDrawing && drawStart && drawCurrent && (
7756 < div style = { { zIndex : Z_INDEX . PREVIEW_SHAPE } } >
7857 < PreviewShape
79- shapeType = { activeShapeType }
80- start = { drawStart }
81- current = { drawCurrent }
82- pixelsPerUnit = { zoomedPixelsPerUnit }
58+ isDrawing = { isDrawing }
59+ drawStart = { drawStart }
60+ drawCurrent = { drawCurrent }
61+ activeShapeType = { activeShapeType }
8362 />
8463 </ div >
8564 ) }
0 commit comments