mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-18 10:31:50 +08:00
perf(editor): optimize the search for the closest element (#9587)
Closes: [BS-2275](https://linear.app/affine-design/issue/BS-2275/拖拽-indicator-查找优化)
This commit is contained in:
@@ -3,7 +3,7 @@ import type { ParagraphBlockModel } from '@blocksuite/affine-model';
|
||||
import { DocModeProvider } from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
calcDropTarget,
|
||||
type DropResult,
|
||||
type DropTarget,
|
||||
findClosestBlockComponent,
|
||||
getBlockProps,
|
||||
getClosestBlockComponentByPoint,
|
||||
@@ -174,7 +174,7 @@ export const getClosestBlockByPoint = (
|
||||
export const getDropResult = (
|
||||
event: MouseEvent,
|
||||
scale: number = 1
|
||||
): DropResult | null => {
|
||||
): DropTarget | null => {
|
||||
let dropIndicator = null;
|
||||
const point = new Point(event.x, event.y);
|
||||
const closestBlock = getClosestBlockComponentByPoint(point) as BlockComponent;
|
||||
|
||||
Reference in New Issue
Block a user