base group
This commit is contained in:
@@ -15,16 +15,7 @@ const ImageObject = ({
|
||||
const [image] = useImage(obj.imageUrl || "");
|
||||
const shapeRef = useRef<Konva.Image>(null);
|
||||
|
||||
useEffect(() => {
|
||||
// اگر draggable=false باشد، یعنی mask اعمال شده و transformer باید به Group متصل شود (نه Image)
|
||||
// پس این useEffect را اجرا نکن
|
||||
if (!draggable) return;
|
||||
|
||||
if (isSelected && shapeRef.current && transformerRef.current && image) {
|
||||
transformerRef.current.nodes([shapeRef.current]);
|
||||
transformerRef.current.getLayer()?.batchDraw();
|
||||
}
|
||||
}, [isSelected, transformerRef, image, draggable]);
|
||||
// Transformer is managed in EditorCanvas for multi-select support
|
||||
|
||||
if (!image) return null;
|
||||
|
||||
@@ -42,10 +33,10 @@ const ImageObject = ({
|
||||
strokeWidth={isSelected && draggable ? 3 : 0}
|
||||
rotation={obj.rotation || 0}
|
||||
draggable={draggable}
|
||||
onClick={draggable ? () => {
|
||||
onClick={draggable ? (e) => {
|
||||
// فقط وقتی mask اعمال نشده onClick handler را فعال کن
|
||||
if (shapeRef.current) {
|
||||
onSelect(obj.id, shapeRef.current);
|
||||
onSelect(obj.id, shapeRef.current, e);
|
||||
}
|
||||
} : undefined}
|
||||
onDragEnd={(e) => {
|
||||
|
||||
Reference in New Issue
Block a user