From 3a3f5b595e5e86bffb85cfa947883f4b469ad7e9 Mon Sep 17 00:00:00 2001 From: Steve Ruiz Date: Sat, 29 Jul 2023 23:44:57 +0100 Subject: [PATCH] [fix] handles updates (#1779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR fixes the signals in the `HandlesWrapper` component. ### Change Type - [x] `patch` — Bug fix --- packages/editor/src/lib/components/Canvas.tsx | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/packages/editor/src/lib/components/Canvas.tsx b/packages/editor/src/lib/components/Canvas.tsx index dfa60bd7f..700a8675c 100644 --- a/packages/editor/src/lib/components/Canvas.tsx +++ b/packages/editor/src/lib/components/Canvas.tsx @@ -190,15 +190,20 @@ function HandlesWrapper() { editor, ]) const isReadonly = useValue('isChangingStyle', () => editor.instanceState.isReadonly, [editor]) + const handles = useValue( + 'handles', + () => (editor.onlySelectedShape ? editor.getHandles(editor.onlySelectedShape) : undefined), + [editor] + ) + const transform = useValue( + 'transform', + () => + editor.onlySelectedShape ? editor.getPageTransform(editor.onlySelectedShape) : undefined, + [editor] + ) if (!Handles || !onlySelectedShape || isChangingStyle || isReadonly) return null - - const handles = editor.getHandles(onlySelectedShape) - if (!handles) return null - - const transform = editor.getPageTransform(onlySelectedShape) - if (!transform) return null // Don't display a temporary handle if the distance between it and its neighbors is too small.