From 5465729c5c6351c6c3d798f9baf72eec60c3b18d Mon Sep 17 00:00:00 2001 From: Dushusir <1414556676@qq.com> Date: Tue, 14 May 2024 19:12:14 +0800 Subject: [PATCH 1/8] feat(render-engine): add drag event listener,Facade add onCellPointerOver,onCellDragOver,onCellDrop --- examples/public/sheets/index.html | 5 +- packages/engine-render/src/base-object.ts | 47 ++++++- packages/engine-render/src/basics/i-events.ts | 11 ++ packages/engine-render/src/engine.ts | 115 ++++++++++++++++ .../engine-render/src/scene.input-manager.ts | 86 +++++++++++- packages/engine-render/src/scene.ts | 46 ++++++- packages/engine-render/src/thin-scene.ts | 22 +++- .../sheets/__tests__/f-sheet-hooks.spec.ts | 2 +- .../facade/src/apis/sheets/f-sheet-hooks.ts | 41 +++++- packages/sheets-ui/src/common/utils.ts | 71 +++++++++- .../src/controllers/drag-render.controller.ts | 63 +++++++++ packages/sheets-ui/src/index.ts | 3 + .../src/services/drag-manager.service.ts | 124 ++++++++++++++++++ .../src/services/hover-manager.service.ts | 71 +++------- packages/sheets-ui/src/sheets-ui-plugin.ts | 4 + 15 files changed, 641 insertions(+), 70 deletions(-) create mode 100644 packages/sheets-ui/src/controllers/drag-render.controller.ts create mode 100644 packages/sheets-ui/src/services/drag-manager.service.ts diff --git a/examples/public/sheets/index.html b/examples/public/sheets/index.html index c228b9f521f..744b31d9b6b 100644 --- a/examples/public/sheets/index.html +++ b/examples/public/sheets/index.html @@ -24,7 +24,10 @@
- + + diff --git a/packages/engine-render/src/base-object.ts b/packages/engine-render/src/base-object.ts index 017bbef7994..732df6cfc21 100644 --- a/packages/engine-render/src/base-object.ts +++ b/packages/engine-render/src/base-object.ts @@ -19,7 +19,7 @@ import { Disposable, Observable } from '@univerjs/core'; import type { EVENT_TYPE } from './basics/const'; import { CURSOR_TYPE, RENDER_CLASS_TYPE } from './basics/const'; -import type { IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events'; +import type { IDragEvent, IMouseEvent, IPointerEvent, IWheelEvent } from './basics/i-events'; import type { IObjectFullState, ITransformChangeState } from './basics/interfaces'; import { TRANSFORM_CHANGE_OBSERVABLE_TYPE } from './basics/interfaces'; import { generateRandomKey, toPx } from './basics/tools'; @@ -72,6 +72,14 @@ export abstract class BaseObject extends Disposable { onPointerEnterObserver = new Observable