From 491c944ac1eff31647749aa7a62f7f4ea21426a7 Mon Sep 17 00:00:00 2001 From: doouding Date: Wed, 14 May 2025 11:27:27 +0000 Subject: [PATCH] fix: drag handler hover rect state is not cleaned (#11868) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes [BS-3261](https://linear.app/affine-design/issue/BS-3261/部分情况下-edgeless-dnd-响应区域有问题) ## Summary by CodeRabbit - **Documentation** - Improved documentation for the drag handle by adding a description for the `force` parameter in the hide method. - **Style** - Minor code formatting adjustments with no impact on functionality. --- blocksuite/affine/widgets/drag-handle/src/drag-handle.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts b/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts index 1eccbb64d7..5cb083ec61 100644 --- a/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts +++ b/blocksuite/affine/widgets/drag-handle/src/drag-handle.ts @@ -46,8 +46,6 @@ export class AffineDragHandleWidget extends WidgetComponent { private readonly _reset = () => { this.dragging = false; - this.dragHoverRect = null; - this.anchorBlockId.value = null; this.isDragHandleHovered = false; this.pointerEventWatcher.reset(); @@ -105,6 +103,9 @@ export class AffineDragHandleWidget extends WidgetComponent { ); }; + /** + * @param force Reset the dragging state + */ hide = (force = false) => { if (this.dragging && !force) return; updateDragHandleClassName(); @@ -112,6 +113,7 @@ export class AffineDragHandleWidget extends WidgetComponent { this.isDragHandleHovered = false; this.anchorBlockId.value = null; + this.dragHoverRect = null; this.activeDragHandle = null; if (this.dragHandleContainer) { @@ -179,7 +181,6 @@ export class AffineDragHandleWidget extends WidgetComponent { this._disposables.addFromEvent(this.host, 'pointerleave', () => { this.hide(); }); - this._handleEventWatcher.watch(); if (isInsidePageEditor(this.host)) {