Skip to content

Documentation / @geoverse/editor-core / SnapIndex

Class: SnapIndex

Defined in: packages/editor-core/src/snap/index.ts:39

吸附索引(rbush)——放核心保证 OL/MapLibre 手感一致(RFC §七)。 适配器经 snapCandidates 喂入视口顶点/线段,按地图单位容差查询最近目标。

Constructors

Constructor

ts
new SnapIndex(): SnapIndex;

Returns

SnapIndex

Methods

load()

ts
load(targets): void;

Defined in: packages/editor-core/src/snap/index.ts:42

Parameters

targets

SnapTarget[]

Returns

void


query()

ts
query(near, tol): SnapHit | null;

Defined in: packages/editor-core/src/snap/index.ts:63

在地图单位容差内找最近吸附点;无命中返回 null。顶点优先于边(同距时)。

Parameters

near

Position

tol

number

Returns

SnapHit | null