From 167ff05f44b328f15ab8eff4ca44d365b058abe7 Mon Sep 17 00:00:00 2001 From: Sean Parsons <217400+seanparsons@users.noreply.github.com> Date: Wed, 2 Oct 2024 12:14:39 +0100 Subject: [PATCH] performance(editor) Combined mouse up handling (#6416) - `useSelectOrLiveModeSelectAndHover` now calls the "global" `handleMouseUp` function that gathers actions from potentially multiple functions. - `EditorCanvas` now hands off it's mouse up handling via the `addMouseUpHandler` utility function. --- ...grid-reparent-strategies.spec.browser2.tsx | 68 +++++++++++++++---- .../select-mode/select-mode-hooks.tsx | 8 ++- editor/src/templates/editor-canvas.tsx | 9 +-- editor/src/templates/global-handlers.tsx | 21 ++++++ 4 files changed, 84 insertions(+), 22 deletions(-) create mode 100644 editor/src/templates/global-handlers.tsx diff --git a/editor/src/components/canvas/canvas-strategies/strategies/grid-reparent-strategies.spec.browser2.tsx b/editor/src/components/canvas/canvas-strategies/strategies/grid-reparent-strategies.spec.browser2.tsx index 909950889d42..fe76a4578c6d 100644 --- a/editor/src/components/canvas/canvas-strategies/strategies/grid-reparent-strategies.spec.browser2.tsx +++ b/editor/src/components/canvas/canvas-strategies/strategies/grid-reparent-strategies.spec.browser2.tsx @@ -299,7 +299,7 @@ describe('grid reparent strategies', () => { await selectComponentsForTest(editor, [EP.fromString('sb/grid/dragme')]) - await dragOut(editor, 'grid', EP.fromString('sb/grid/dragme'), { x: 2000, y: 1000 }) + await dragOut(editor, EP.fromString('sb/grid/dragme'), { x: 2000, y: 1000 }) expect(getPrintedUiJsCode(editor.getEditorState())).toEqual( formatTestProjectCode( @@ -311,8 +311,8 @@ describe('grid reparent strategies', () => { width: 79, height: 86, position: 'absolute', - top: 391, - left: 492, + top: 934, + left: 1627, }} data-uid='dragme' data-testid='dragme' @@ -367,6 +367,7 @@ describe('grid reparent strategies', () => { height: 86, }} data-uid='bar' + data-testid='bar' />