Skip to content

Commit

Permalink
fix: text not selected after editing
Browse files Browse the repository at this point in the history
  • Loading branch information
gkuzin13 committed Feb 20, 2024
1 parent 0bc49d4 commit 1c6a7c7
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ const DrawingCanvas = forwardRef<Konva.Stage, Props>(
const isSelectTool = toolType === 'select';
const isSelecting = drawing && isSelectTool;
const isLayerListening = !isHandTool;
const hasSelectedNodes = selectedNodeIds.length > 0;

/**
* syncs with store state when selected nodes change
Expand Down Expand Up @@ -340,18 +339,15 @@ const DrawingCanvas = forwardRef<Konva.Stage, Props>(
handleDraftCreate(toolType, pointerPosition);
}

if (hasSelectedNodes && toolType === 'select') {
setSelectedNodeIds([]);
dispatch(canvasActions.setSelectedNodeIds([]));
}

if (editingNodeId) {
setEditingNodeId(null);
}

setSelectedNodeIds([]);
dispatch(canvasActions.setSelectedNodeIds([]));
},
[
toolType,
hasSelectedNodes,
editingNodeId,
handleDraftCreate,
setDrawingPosition,
Expand Down
12 changes: 7 additions & 5 deletions apps/client/src/components/Canvas/DrawingCanvas/Nodes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,13 @@ const Nodes = ({
/>
);
})}
<NodesTransformer
selectedNodes={selectedNodes}
stageScale={stageScale}
onNodesChange={onNodesChange}
/>
{!editingNodeId && (
<NodesTransformer
selectedNodes={selectedNodes}
stageScale={stageScale}
onNodesChange={onNodesChange}
/>
)}
</>
);
};
Expand Down

0 comments on commit 1c6a7c7

Please sign in to comment.