Skip to content

Commit 177dfad

Browse files
committed
fix(canvas): keep click-marked framing when auto-focus is off, recut tooltips
Gating the whole click branch on the setting also skipped the userFocusedWorkflowIdRef write, which is what stops <ReactFlow onInit> from running fitView over the user's framing. That would have blown away the framing of exactly the users who turned auto-focus off to keep it. Mark the workflow as user-framed on any plain node click and gate only the camera move. Crop the auto-focus preview to the recording's viewport center so the blocks are legible at the 240px width Tooltip.Preview renders at, and trim the 2.45s of empty lead off the error-notification preview.
1 parent 489d55b commit 177dfad

4 files changed

Lines changed: 11 additions & 4 deletions

File tree

apps/sim/app/workspace/[workspaceId]/w/[workflowId]/workflow.tsx

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4327,19 +4327,26 @@ const WorkflowContent = React.memo(
43274327
* Focus the clicked block: animate the camera so the card centers in
43284328
* the canvas frame. Plain clicks focus both regular cards and subflow
43294329
* containers; multi-select keeps the camera still. Users who would
4330-
* rather keep their own framing turn this off in general settings.
4331-
* onNodeClick never fires after a drag.
4330+
* rather keep their own framing turn auto-focus off in general
4331+
* settings. onNodeClick never fires after a drag.
43324332
*/
43334333
if (
43344334
!embedded &&
43354335
!isMultiSelect &&
4336-
isAutoFocusOnClickEnabled &&
43374336
(node.type === 'workflowBlock' ||
43384337
node.type === 'noteBlock' ||
43394338
node.type === 'subflowNode')
43404339
) {
4340+
/**
4341+
* Marked whether or not the camera moves: with auto-focus on the
4342+
* click reframes the canvas, and with it off the click is the user
4343+
* deliberately keeping the framing they already have. Either way a
4344+
* later canvas re-init must not `fitView` over it.
4345+
*/
43414346
userFocusedWorkflowIdRef.current = activeWorkflowId ?? workflowIdParam
4342-
focusBlockInView(node)
4347+
if (isAutoFocusOnClickEnabled) {
4348+
focusBlockInView(node)
4349+
}
43434350
}
43444351
},
43454352
[
6.86 KB
Binary file not shown.
35.6 KB
Binary file not shown.
-6.62 KB
Binary file not shown.

0 commit comments

Comments
 (0)