webgl-network-view 0.1.5 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -275,7 +275,7 @@ export type GisViewLineDashValues = [number, number] | [number, number, number,
275
275
  export type GisViewLineDash = GisViewLineDashValues
276
276
 
277
277
  /** 悬停目标的分类,与光标配置一一对应 */
278
- export type GisViewCursorTarget = 'point' | 'line' | 'channel' | 'waypoint'
278
+ export type GisViewCursorTarget = 'point' | 'line' | 'channel' | 'waypoint' | 'background'
279
279
 
280
280
  /**
281
281
  * 单个光标的写法:
@@ -287,7 +287,7 @@ export type GisViewCursorTarget = 'point' | 'line' | 'channel' | 'waypoint'
287
287
  export type GisViewCursorValue = string | { url?: string; path?: string; src?: string; hotspot?: [number, number]; fallback?: string }
288
288
 
289
289
  /**
290
- * 光标配置:按状态(空白 / 平移 / 框选 / 拖动 / 草稿 / 复制)与悬停目标(节点 / 线路 / 通道回线 / 拐点)分别配,
290
+ * 光标配置:按状态(空白 / 平移 / 框选 / 拖动 / 草稿 / 复制)与悬停目标(节点 / 线路 / 通道回线 / 拐点 / 背景)分别配,
291
291
  * ctrl 里是按住框选(默认 Shift)、多选 / 加点(默认 Ctrl / ⌘)这几个快捷键的修饰键时的替代值
292
292
  * (只写想换的那几个键,其余回落到同名键)。
293
293
  * 每一条要素还可以用自身的 cursor / ctrlCursor 覆盖悬停目标上的配置。
@@ -313,6 +313,8 @@ export interface GisViewCursorStyle {
313
313
  channel?: GisViewCursorValue
314
314
  /** 悬停在拐点上,默认 --network-view-cursor-waypoint */
315
315
  waypoint?: GisViewCursorValue
316
+ /** 悬停在背景目标上(命中 GeoJSON 时为具体区域,空白背景也可触发),默认 --network-view-cursor-background(pointer) */
317
+ background?: GisViewCursorValue
316
318
  /** 按住 Ctrl(macOS 为 Cmd)时的替代光标:键与上面相同,只写想换的那几个 */
317
319
  ctrl?: {
318
320
  idle?: GisViewCursorValue
@@ -325,6 +327,7 @@ export interface GisViewCursorStyle {
325
327
  line?: GisViewCursorValue
326
328
  channel?: GisViewCursorValue
327
329
  waypoint?: GisViewCursorValue
330
+ background?: GisViewCursorValue
328
331
  }
329
332
  }
330
333
 
@@ -1160,7 +1163,7 @@ export interface GisViewEffectsOptions {
1160
1163
  /** options.effects 的写法:布尔(总开关)或配置对象;null / 不写 = 按数据与逐要素配置决定 */
1161
1164
  export type GisViewEffectsInput = GisViewEffectsOptions | boolean | null
1162
1165
  /**
1163
- * 预热(options.prebake):把「这次画面会出现什么」提前告诉组件,它在第一帧之前就烤好。
1166
+ * 符号贴图预热(preprocess.symbols):把「这次画面会出现什么」提前告诉组件,它在第一帧之前就烤好。
1164
1167
  *
1165
1168
  * 两种写法(可以一起用):`combos` 逐组合(一条一张贴图,`getSymbolCombos()` 收出来的就是它);
1166
1169
  * `symbols × pointColors × sizes` 与 `lineColors × 线路动画图标` 是省事的全排列 ——
@@ -1181,7 +1184,7 @@ export interface GisViewPrebakeOptions {
1181
1184
  combos?: GisViewPrebakeCombo[]
1182
1185
  }
1183
1186
  /**
1184
- * 一条贴图组合(`prebake.combos` 的一条):符号 + 颜色 + 尺寸(+ 描边),
1187
+ * 一条贴图组合(`preprocess.symbols.combos` 的一条):符号 + 颜色 + 尺寸(+ 描边),
1185
1188
  * 与画的时候喂给符号库的那几个参数一一对应 —— getSymbolCombos 返回的就是这种形状,原样喂回去即可。
1186
1189
  */
1187
1190
  export interface GisViewPrebakeCombo {
@@ -1198,13 +1201,17 @@ export interface GisViewPrebakeCombo {
1198
1201
  }
1199
1202
  /** 归一化之后的预热配置(getPrebake 的读数):没配预热时整份是 null */
1200
1203
  export interface GisViewPrebakeReadout {
1204
+ /** 是否按当前数据自动收集组合(preprocess.symbols: true) */
1205
+ auto: boolean
1201
1206
  symbols: GisViewSymbolInput[]
1202
1207
  pointColors: string[]
1203
1208
  lineColors: string[]
1204
1209
  sizes: number[]
1205
1210
  combos: GisViewPrebakeCombo[]
1211
+ /** 上一次真正走符号库解析的组合数;idle 模式还没跑时是 0,getPrebake 仍会给出待烤清单 */
1212
+ baked: number
1206
1213
  }
1207
- /** getSymbolCombos 的读数:这份数据真正会用到的组合(combos 可直接喂给 prebake.combos;后三项是全排列写法的输入) */
1214
+ /** getSymbolCombos 的读数:这份数据真正会用到的组合(combos 可直接喂给 preprocess.symbols.combos;后三项是全排列写法的输入) */
1208
1215
  export interface GisViewSymbolCombos {
1209
1216
  /** 节点侧的组合 + 线路侧「线色 × 动画图标」的组合 */
1210
1217
  combos: GisViewPrebakeCombo[]
@@ -2860,9 +2867,15 @@ export interface GisViewGeoJsonLabelStyle {
2860
2867
  export interface GisViewGeoJsonRegionStyle {
2861
2868
  name?: string
2862
2869
  areaColor?: string
2870
+ /** areaColor 的别名;两者同时写时 areaColor 优先 */
2871
+ fill?: string
2863
2872
  fillOpacity?: number
2864
2873
  borderColor?: string
2874
+ /** borderColor 的别名;两者同时写时 borderColor 优先 */
2875
+ stroke?: string
2865
2876
  borderWidth?: number
2877
+ /** borderWidth 的别名;两者同时写时 borderWidth 优先 */
2878
+ strokeWidth?: number
2866
2879
  /** 覆盖描边 / 点的整体透明度 */
2867
2880
  opacity?: number
2868
2881
  pointColor?: string
@@ -2882,11 +2895,17 @@ export interface GisViewGeoJsonRegionParams {
2882
2895
  export interface GisViewGeoJsonStyle {
2883
2896
  /** 区域填充色(ECharts 的 itemStyle.areaColor) */
2884
2897
  areaColor?: string
2898
+ /** areaColor 的别名;两者同时写时 areaColor 优先 */
2899
+ fill?: string
2885
2900
  fillOpacity?: number
2886
2901
  /** 区域描边色(ECharts 的 itemStyle.borderColor) */
2887
2902
  borderColor?: string
2903
+ /** borderColor 的别名;两者同时写时 borderColor 优先 */
2904
+ stroke?: string
2888
2905
  /** 区域描边宽度(ECharts 的 itemStyle.borderWidth) */
2889
2906
  borderWidth?: number
2907
+ /** borderWidth 的别名;两者同时写时 borderWidth 优先 */
2908
+ strokeWidth?: number
2890
2909
  /** y 轴比例,与 ECharts 的 geo.aspectScale 一致:默认 0.75;坐标不是经纬度时传 1 */
2891
2910
  aspectScale?: number
2892
2911
  /**
@@ -3084,6 +3103,46 @@ export interface GisViewResolvedGeoJson {
3084
3103
  shadow: { color: [number, number, number, number]; offsets: Array<[number, number]> } | null
3085
3104
  }
3086
3105
 
3106
+ /** 背景 GeoJSON 区域拾取结果:命中区域的解析读数与命中位置(坐标口径见字段注释) */
3107
+ export interface GisViewBackgroundPickResult {
3108
+ type: 'background'
3109
+ /** 区域在 GeoJSON features 里的下标 */
3110
+ index: number
3111
+ name?: string
3112
+ properties: Record<string, unknown>
3113
+ bounds: GisViewBounds | null
3114
+ center: [number, number] | null
3115
+ /** 命中位置的世界坐标 */
3116
+ coordinate: [number, number]
3117
+ /** 命中位置的画布 CSS 像素坐标 */
3118
+ screen: [number, number]
3119
+ /** 当前解析出来的填充色(RGBA,0 ~ 1) */
3120
+ fillColor: [number, number, number, number]
3121
+ /** 当前解析出来的描边色(RGBA,0 ~ 1) */
3122
+ strokeColor: [number, number, number, number]
3123
+ strokeWidth: number
3124
+ /** 命中区域的完整解析结果(多边形、文字、颜色等) */
3125
+ region: GisViewResolvedGeoJsonRegion
3126
+ /** 配了 GeoJSON 底图时,命中位置对应的真实经纬度 */
3127
+ lngLat?: [number, number]
3128
+ }
3129
+
3130
+ /**
3131
+ * 背景事件开关:默认全关;写 true 一次打开 hover / click / dblClick / contextMenu,
3132
+ * 对象写法只打开显式写 true 的项。背景事件与 features.hover / features.contextMenu 相互独立,
3133
+ * 但在 backgroundEditing 期间停用;数据要素命中优先,背景只在没有数据命中时作为回退目标。
3134
+ * 开启后画布空白本身也是背景目标,命中 GeoJSON 时才额外带 region 等区域字段。
3135
+ */
3136
+ export interface GisViewBackgroundEventOptions {
3137
+ hover?: boolean
3138
+ click?: boolean
3139
+ dblClick?: boolean
3140
+ contextMenu?: boolean
3141
+ }
3142
+
3143
+ /** backgroundEvents 的入参:true 全开,false / 不写全关 */
3144
+ export type GisViewBackgroundEventsInput = boolean | GisViewBackgroundEventOptions
3145
+
3087
3146
  /** 解析后 GeoJSON 的最终摆放参数:先按 aspectScale 生成源范围,再缩放 / 平移 / 旋转到画面 */
3088
3147
  export interface GisViewGeoDrawTransform {
3089
3148
  scaleX: number
@@ -3652,11 +3711,11 @@ export type GisViewClickPayload = (GisViewPickResult | GisViewSelectionBoxPickRe
3652
3711
 
3653
3712
  /**
3654
3713
  * 这一次指针操作命中的是什么:'point'(节点)/ 'line'(通道外的线路)/ 'channel'(通道内的回线)/
3655
- * 'waypoint'(线路拐点)/ 'selectionBox'(保留框选框的空白区域)/ 'label'(标签)/
3714
+ * 'waypoint'(线路拐点)/ 'background'(画布背景,GeoJSON 命中时另带区域)/ 'selectionBox'(保留框选框的空白区域)/ 'label'(标签)/
3656
3715
  * 'selection'(一整批选中集,只有 selectChange 用)/ 'empty'(空白)。
3657
3716
  * 与载荷里的 type 差一层:通道回线的 type 也是 'line',但按通道处理的多,target 单独给一个 'channel'。
3658
3717
  */
3659
- export type GisViewPointerTarget = 'point' | 'line' | 'channel' | 'cluster' | 'waypoint' | 'selectionBox' | 'label' | 'selection' | 'empty'
3718
+ export type GisViewPointerTarget = 'point' | 'line' | 'channel' | 'cluster' | 'waypoint' | 'background' | 'selectionBox' | 'label' | 'selection' | 'empty'
3660
3719
 
3661
3720
  /**
3662
3721
  * 一次指针操作的动作名。同一个名字在「按下 / 松开 / 点击」三条事件里含义略有不同:
@@ -3720,6 +3779,60 @@ export interface GisViewPointerAction {
3720
3779
  longPress?: boolean
3721
3780
  }
3722
3781
 
3782
+ /** 背景事件的动作:hover 离开画布背景时载荷为 null,其余三类只在对应开关打开时派发 */
3783
+ export type GisViewBackgroundActionType = 'hover' | 'click' | 'dblClick' | 'contextMenu'
3784
+
3785
+ /** 背景事件的 action:与数据指针事件同一套判读,target 固定为 background */
3786
+ export interface GisViewBackgroundAction extends GisViewPointerAction {
3787
+ type: GisViewBackgroundActionType
3788
+ target: 'background'
3789
+ }
3790
+
3791
+ /**
3792
+ * 背景事件载荷(onBackgroundHover / Click / DblClick / ContextMenu 与同名事件):
3793
+ * 任意画布背景位置都有 type / index / coordinate / screen / hit / action / 光标位置与原始 DOM 事件;
3794
+ * 命中 GeoJSON 时区域字段与 pickBackground 一致,否则 index / name / properties / bounds / center /
3795
+ * fillColor / strokeColor / strokeWidth / region 都是 null。tooltip 的内容函数会把 region
3796
+ * (空白背景为 null)作为 params.data 传入。
3797
+ */
3798
+ export interface GisViewBackgroundEventPayload {
3799
+ type: 'background'
3800
+ /** 背景目标总是命中;GeoJSON 是否有具体区域看 region 是否为 null */
3801
+ hit: true
3802
+ action: GisViewBackgroundAction
3803
+ /** 命中 GeoJSON 时是区域在 features 里的下标;空白背景为 null */
3804
+ index: number | null
3805
+ /** 命中 GeoJSON 时的区域名;特征没有名字或空白背景时为 null */
3806
+ name?: string | null
3807
+ /** 命中 GeoJSON 时的 properties;空白背景为 null */
3808
+ properties: Record<string, unknown> | null
3809
+ /** 命中 GeoJSON 时的区域范围;空白背景为 null */
3810
+ bounds: GisViewBounds | null
3811
+ /** 命中 GeoJSON 时的区域中心;空白背景为 null */
3812
+ center: [number, number] | null
3813
+ /** 命中位置的世界坐标 */
3814
+ coordinate: [number, number]
3815
+ /** 命中位置的画布 CSS 像素坐标 */
3816
+ screen: [number, number]
3817
+ /** 命中 GeoJSON 时的当前解析填充色;空白背景为 null */
3818
+ fillColor: [number, number, number, number] | null
3819
+ /** 命中 GeoJSON 时的当前解析描边色;空白背景为 null */
3820
+ strokeColor: [number, number, number, number] | null
3821
+ /** 命中 GeoJSON 时的当前解析描边宽度;空白背景为 null */
3822
+ strokeWidth: number | null
3823
+ /** 命中 GeoJSON 时的完整解析结果;空白背景为 null */
3824
+ region: GisViewResolvedGeoJsonRegion | null
3825
+ /** 配了 GeoJSON 底图时,背景位置对应的真实经纬度 */
3826
+ lngLat?: [number, number]
3827
+ /** 光标处的世界坐标(与 coordinate 相同,保留与数据指针载荷一致的字段名) */
3828
+ world: [number, number]
3829
+ /** 光标在画布 CSS 像素里的位置 */
3830
+ x: number
3831
+ y: number
3832
+ /** 最近一次指针事件;程序化悬停或没有现场事件时不带 */
3833
+ originalEvent?: PointerEvent | MouseEvent | Event | null
3834
+ }
3835
+
3723
3836
  /**
3724
3837
  * 通用指针载荷:左键按下 / 抬起、右键都会发一条。
3725
3838
  * 命中的要素(点 / 线 / 通道回线)在 type / index / item 与通道字段里,没有命中时 type 为 null、hit 为 false;
@@ -4994,7 +5107,7 @@ export interface GisViewRuleGroupReadout {
4994
5107
  }
4995
5108
 
4996
5109
  /**
4997
- * 规则预处理配置(options.rulePreprocess):
5110
+ * 规则预处理配置(preprocess.rules):
4998
5111
  * - `true` / `{ enabled: true }`:按启用中的规则提前解析符号,并在整批解析时复用条件字段组合相同的规则样式;
4999
5112
  * - `symbols`:是否预热节点规则里的符号,缺省 true;
5000
5113
  * - `decorations`:是否预热线路规则里的装饰符号,缺省 true;
@@ -5008,9 +5121,35 @@ export interface GisViewRulePreprocessOptions {
5008
5121
  /** 是否预热线路规则里的装饰符号,缺省 true */
5009
5122
  decorations?: boolean
5010
5123
  }
5011
- /** options.rulePreprocess 的写法:布尔总开关或详细配置 */
5124
+ /** preprocess.rules 的写法:布尔总开关或详细配置 */
5012
5125
  export type GisViewRulePreprocessInput = GisViewRulePreprocessOptions | boolean | null
5013
5126
 
5127
+ /**
5128
+ * 预处理 / 预热总配置(options.preprocess):
5129
+ * - `true` / `'idle'`:所有子项开启,空闲时执行;
5130
+ * - `'eager'`:所有子项开启,初始化 / 数据变化时尽量当场执行,用更长的初始化换取后续交互更流畅;
5131
+ * - 对象:按项开启,`mode` 控制这一轮准备是空闲排队还是当场执行。
5132
+ *
5133
+ * 整个 `preprocess` 不写:只保留「features 里有交互能力就空闲建交互索引」的默认路径;
5134
+ * `false` / `null`:全关。旧顶层 prebake / rulePreprocess / searchPreload 已移除。
5135
+ */
5136
+ export interface GisViewPreprocessOptions {
5137
+ /** 空闲排队(idle,缺省)还是尽早执行(eager) */
5138
+ mode?: 'idle' | 'eager'
5139
+ /** 符号贴图:true = 按当前数据自动收组合;对象 = 精确 combos / 全排列配置;缺省关 */
5140
+ symbols?: boolean | GisViewPrebakeOptions
5141
+ /** 规则符号预处理:true 或 { enabled, symbols, decorations };缺省关 */
5142
+ rules?: GisViewRulePreprocessInput
5143
+ /** 交互网格 / 绑定索引 / 惰性 id 表 / 细线账本与首次只读拾取;对象写法不写时关闭,整个 preprocess 不写时才按 features 推断 */
5144
+ interaction?: boolean
5145
+ /** 交互后备缓冲(非 MSAA / 细线管线)预热;缺省跟随 interaction */
5146
+ target?: boolean
5147
+ /** 搜索缓存预加载(preloadSearch 的自动调度);缺省关,手动 preloadSearch() 始终可用 */
5148
+ search?: boolean
5149
+ }
5150
+ /** options.preprocess 的写法:布尔、模式字符串或详细配置 */
5151
+ export type GisViewPreprocessInput = GisViewPreprocessOptions | boolean | 'idle' | 'eager' | null
5152
+
5014
5153
  /** 规则预处理的读数:收集到多少条规则组合,以及其中贴图 / 着色器形状各多少 */
5015
5154
  export interface GisViewRulePreprocessReadout {
5016
5155
  /** 当前是否开启 */
@@ -5177,7 +5316,7 @@ export interface GisViewItemLabel {
5177
5316
  avoidOverlap?: boolean
5178
5317
  /**
5179
5318
  * 这一条撞上别的标签之后怎么避让:`shift`(默认)主动换锚点 / 沿线挪,`hide` 直接不显示。
5180
- * 只在所属类别处于优化档(节点看 `options.labels.optimize`、线路看 `options.labels.lineOptimize`,后者未写时继承前者)且这条的 `avoidOverlap` 不为 false 时生效;只和底图区域文字重叠时仍按软冲突照画。
5319
+ * 只在所属类别处于优化档(`options.labels.optimize.point` / `options.labels.optimize.line`,线路未写时继承节点)且这条的 `avoidOverlap` 不为 false 时生效;只和底图区域文字重叠时仍按软冲突照画。
5181
5320
  */
5182
5321
  overlapMode?: GisViewLabelOverlapMode
5183
5322
  /** 显隐策略:auto 智能隐藏 / always 一直显示 / hidden 不显示 */
@@ -5720,6 +5859,8 @@ export interface GisViewLabelState {
5720
5859
  priority: number | null
5721
5860
  /** 改过的碰撞检查对象;没改过是 null(按配置缺省只查标签) */
5722
5861
  collisionTargets: GisViewLabelCollisionTargets | null
5862
+ /** 改过的「是否参与避让」;没改过是 null */
5863
+ avoidOverlap: boolean | null
5723
5864
  /** 这一条是运行时加的(addLabel),不是配置 / 数据里声明的 */
5724
5865
  added: boolean
5725
5866
  /** 运行时加的标签的定义(addLabel 的入参),持久化回显时按它重建;不是运行时标签时为 null */
@@ -5759,6 +5900,8 @@ export interface GisViewLabelPatch {
5759
5900
  priority?: number | null
5760
5901
  /** 避让时检查哪些对象;写 null 回到默认 */
5761
5902
  collisionTargets?: GisViewLabelCollisionTargets | null
5903
+ /** 这一条是否参与避让;写 null 回到默认 */
5904
+ avoidOverlap?: boolean | null
5762
5905
  }
5763
5906
 
5764
5907
  /**
@@ -6369,8 +6512,16 @@ export interface GisViewDecorationCommitResult {
6369
6512
  draft?: GisViewDecorationDraftPayload
6370
6513
  }
6371
6514
 
6372
- /** 悬浮提示内容:模板字符串,或返回文本 / 元素 / null / false 的函数;false 与空字符串不显示,undefined 表示本层无结果并继续回落;函数的 data 与 item 同一份 */
6373
- export type GisViewTooltipContent = string | ((params: GisViewPickResult & { data: GisViewPoint | GisViewLine }) => string | HTMLElement | number | null | undefined | false)
6515
+ /**
6516
+ * 提示内容函数与位置函数拿到的参数:数据要素是拾取结果,data 与 item 同一份;
6517
+ * 背景是背景事件载荷,data 与 region 同一份(空白背景为 null)。用 params.type === 'background' 收窄。
6518
+ */
6519
+ export type GisViewTooltipParams =
6520
+ | (GisViewPickResult & { data: GisViewPoint | GisViewLine })
6521
+ | (GisViewBackgroundEventPayload & { data: GisViewResolvedGeoJsonRegion | null })
6522
+
6523
+ /** 悬浮提示内容:模板字符串,或返回文本 / 元素 / null / false 的函数;false 与空字符串不显示,undefined 表示本层无结果并继续回落 */
6524
+ export type GisViewTooltipContent = string | ((params: GisViewTooltipParams) => string | HTMLElement | number | null | undefined | false)
6374
6525
 
6375
6526
  /** 提示框相对锚点的固定方位;pointer 跟随实时指针,pointer-center 以锚点为框中心;enterable 时锚点在首次出现时锁定,四角是斜向摆放 */
6376
6527
  export type GisViewTooltipPlacement = 'pointer' | 'pointer-center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'center'
@@ -6395,13 +6546,15 @@ export interface GisViewTooltipPositionContext {
6395
6546
  * 提示框位置:固定方位,或返回画布 CSS 像素绝对落点 { x, y } / [x, y] 的函数。
6396
6547
  * 函数结果仍会被夹回视口;返回 null / undefined / 非有限数字时回落到 pointer。
6397
6548
  */
6398
- export type GisViewTooltipPosition = GisViewTooltipPlacement | ((payload: GisViewPickResult & { data: GisViewPoint | GisViewLine }, context: GisViewTooltipPositionContext) => GisViewCoordinate | null | undefined)
6549
+ export type GisViewTooltipPosition = GisViewTooltipPlacement | ((payload: GisViewTooltipParams, context: GisViewTooltipPositionContext) => GisViewCoordinate | null | undefined)
6399
6550
 
6400
6551
  export interface GisViewTooltipOptions {
6401
6552
  /** 配置了 tooltip 就默认显示,显式 false 关闭 */
6402
6553
  enabled?: boolean
6403
6554
  /** 兜底内容:没配分类内容时用 */
6404
6555
  content?: GisViewTooltipContent
6556
+ /** 背景专属内容,false 表示背景不显示提示;空白背景也会进入,可按 params.region 分支。不写时回落到 content 或区域 name */
6557
+ background?: GisViewTooltipContent | false
6405
6558
  /** 节点专属内容,false 表示节点不显示提示 */
6406
6559
  point?: GisViewTooltipContent | false
6407
6560
  /** 线专属内容,false 表示线不显示提示 */
@@ -6850,6 +7003,11 @@ export interface GisViewFitSpacingOptions {
6850
7003
  minDistance?: number
6851
7004
  /** 距离模式二:可见节点里最远一对的中心距不超过这个屏幕距离(CSS 像素);与 minDistance 二选一,同时给时只启用它 */
6852
7005
  maxDistance?: number
7006
+ /**
7007
+ * 间距调整后自动回到未启用 fitSpacing 的普通适应比例:
7008
+ * true 用 450ms 平滑过渡,数字按毫秒指定时长,0 立即落位,false / 不写关闭。
7009
+ */
7010
+ restore?: boolean | number
6853
7011
  }
6854
7012
 
6855
7013
  /**
@@ -7645,6 +7803,11 @@ export interface GisViewEventMap {
7645
7803
  idle: GisViewIdlePayload
7646
7804
  cursor: GisViewCursorPayload
7647
7805
  hover: GisViewHoverPayload
7806
+ /** 背景悬停:进入 / 换目标发载荷(空白背景 region 为 null),离开 / 关闭时载荷为 null */
7807
+ backgroundHover: GisViewBackgroundEventPayload | null
7808
+ backgroundClick: GisViewBackgroundEventPayload
7809
+ backgroundDblClick: GisViewBackgroundEventPayload
7810
+ backgroundContextMenu: GisViewBackgroundEventPayload
7648
7811
  pointer: GisViewPointerState
7649
7812
  pointerDown: GisViewPointerPayload
7650
7813
  pointerUp: GisViewPointerPayload
@@ -7838,6 +8001,8 @@ export interface GisViewChannelSimplifyOptions {
7838
8001
  */
7839
8002
  export interface GisViewA11yOptions {
7840
8003
  enabled?: boolean
8004
+ /** 画布根节点的无障碍名称,缺省「GIS 视图」 */
8005
+ label?: string
7841
8006
  instructions?: boolean | string
7842
8007
  liveSelection?: boolean
7843
8008
  }
@@ -7857,12 +8022,13 @@ export interface GisViewLabelOptionsGroup {
7857
8022
  /** 整条通道标签;只读,不继承 defaults */
7858
8023
  channel?: GisViewChannelLabelOptions | GisViewChannelLabelContent | Array<GisViewChannelLabelOptions | GisViewChannelLabelContent>
7859
8024
  /**
7860
- * 节点标签优化开关:true 启用避让 / 换落点 / maxCount / 扫描预算;
7861
- * false 强制显示全部标签,密集档也不会覆盖;不写时普通档强制显示、密集档自动优化。
8025
+ * 标签优化开关:true 启用避让 / 换落点 / maxCount / 扫描预算,false 强制显示全部标签;
8026
+ * 对象按节点 / 线路分别配置,line 不写时继承 point,整项不写时普通档强制显示、密集档自动优化。
7862
8027
  */
7863
- optimize?: boolean
7864
- /** 线路 / 分组 / 通道标签优化开关;false 同样强制显示(密集档也不覆盖),不写时继承 optimize */
7865
- lineOptimize?: boolean
8028
+ optimize?: boolean | {
8029
+ point?: boolean
8030
+ line?: boolean
8031
+ }
7866
8032
  /** 标签容器渲染模式,缺省 auto */
7867
8033
  render?: 'auto' | 'canvas' | 'dom'
7868
8034
  /** 标签运行时状态(getLabelStates() 的输出) */
@@ -7895,6 +8061,76 @@ export interface GisViewChannelOptionsGroup {
7895
8061
  waypointDragMode?: GisViewChannelWaypointDragMode
7896
8062
  }
7897
8063
 
8064
+ /** 网格:enabled 为总开关,color / size 只在画网格时生效。 */
8065
+ export interface GisViewGridOptions {
8066
+ /** 是否绘制网格,缺省 false */
8067
+ enabled?: boolean
8068
+ /** 网格线颜色 */
8069
+ color?: string
8070
+ /** 网格线的屏幕目标间距(像素),实际步长吸附到 1 / 2 / 5 x 10^n */
8071
+ size?: number
8072
+ }
8073
+
8074
+ /** 网架展示:只影响数据层,不改变底图、网格与自定义 WebGL 层。 */
8075
+ export interface GisViewNetworkOptions {
8076
+ /** 是否绘制节点、线路、通道、装饰、动画与标签,缺省 true */
8077
+ visible?: boolean
8078
+ /** 网架整体不透明度(0 ~ 1),缺省 1 */
8079
+ opacity?: number
8080
+ }
8081
+
8082
+ /** 拐点展示:显示时机、基础样式与选中样式。 */
8083
+ export interface GisViewWaypointOptions {
8084
+ /** selected 只在线路被选中(或刚加过拐点)时显示,always 始终显示;默认 selected */
8085
+ visibility?: 'selected' | 'always'
8086
+ /** 拐点基础样式,缺省为小圆点 */
8087
+ style?: GisViewPointStyle
8088
+ /** 拐点被选中时的样式 */
8089
+ selectStyle?: GisViewPointStyle
8090
+ }
8091
+
8092
+ /** 交互期渲染档位;交互权限仍只由 features 控制。 */
8093
+ export interface GisViewInteractionOptions {
8094
+ /** 交互期细线快路径,默认 true */
8095
+ thinLines?: boolean
8096
+ /** 交互 / 动画期使用非 MSAA 后备缓冲,默认 true */
8097
+ noMsaa?: boolean
8098
+ /** 交互帧分辨率:auto 或 0.25 ~ 1 的固定倍率 */
8099
+ resolution?: number | 'auto'
8100
+ }
8101
+
8102
+ /** 后台计算:筛选与异步搜索各自的 Worker 开关。 */
8103
+ export interface GisViewWorkerOptions {
8104
+ filter?: boolean | GisViewFilterWorkerOptions
8105
+ search?: boolean | GisViewSearchWorkerOptions
8106
+ }
8107
+
8108
+ /** 悬停 / 选中 / 多选 / 框选 / 级联高亮样式与内置强调开关。 */
8109
+ export interface GisViewHighlightOptions {
8110
+ /** 没有配置对应状态样式时,是否仍用尺寸 / 宽度增幅画出内置强调;默认 false */
8111
+ default?: boolean
8112
+ /** 点击级联高亮;不进选中集,与悬停 / 选中样式分开 */
8113
+ cascade?: GisViewCascadeHighlightInput
8114
+ point?: {
8115
+ /** 悬停样式;传 null 表示清掉 */
8116
+ hover?: GisViewPointStyle | null
8117
+ /** 选中样式;传 null 表示清掉 */
8118
+ select?: GisViewPointStyle | null
8119
+ /** Ctrl / multiSelect 累加多选样式;缺省沿用 select */
8120
+ multiSelect?: GisViewPointStyle | null
8121
+ /** 框选命中样式;缺省沿用 select */
8122
+ boxSelect?: GisViewPointStyle | null
8123
+ }
8124
+ line?: {
8125
+ /** 悬停样式;传 null 表示清掉 */
8126
+ hover?: GisViewLineStyle | null
8127
+ /** 选中样式;传 null 表示清掉 */
8128
+ select?: GisViewLineStyle | null
8129
+ /** Ctrl / multiSelect 累加多选样式;缺省沿用 select */
8130
+ multiSelect?: GisViewLineStyle | null
8131
+ }
8132
+ }
8133
+
7898
8134
  export interface GisViewOptions {
7899
8135
  /** 标签配置,见 GisViewLabelOptionsGroup */
7900
8136
  labels?: GisViewLabelOptionsGroup
@@ -7902,6 +8138,18 @@ export interface GisViewOptions {
7902
8138
  selection?: GisViewSelectionOptionsGroup
7903
8139
  /** 通道默认配置,见 GisViewChannelOptionsGroup */
7904
8140
  channel?: GisViewChannelOptionsGroup
8141
+ /** 网格配置;true / false 等价于 { enabled: true / false } */
8142
+ grid?: boolean | GisViewGridOptions
8143
+ /** 网架显隐与不透明度;true / false 等价于 { visible: true / false } */
8144
+ network?: boolean | GisViewNetworkOptions
8145
+ /** 拐点显示时机与样式 */
8146
+ waypoint?: GisViewWaypointOptions
8147
+ /** 交互期渲染档位(不是交互权限) */
8148
+ interaction?: GisViewInteractionOptions
8149
+ /** 筛选 / 搜索 Worker;true / false 同时控制两者 */
8150
+ worker?: boolean | GisViewWorkerOptions
8151
+ /** 悬停 / 选中 / 多选 / 框选 / 级联高亮样式 */
8152
+ highlight?: GisViewHighlightOptions
7905
8153
  /**
7906
8154
  * 功能开关:预设名('edit' / 'view' / 'static')、开关表或布尔值 ——
7907
8155
  * **缺省全关**:什么都不写时只剩画布与数据,想要哪一项就手动打开哪一项。
@@ -7940,7 +8188,7 @@ export interface GisViewOptions {
7940
8188
  /**
7941
8189
  * 大数据展示模式:`'auto'`(缺省)按可见节点 / 线路数、节点屏幕密度与数据总量自动切;
7942
8190
  * `'on'` / `'off'` / true / false 强制开关;对象写法可改点 / 线各自阈值(见 GisViewDenseModeOptions)。
7943
- * 进入密集档后,未显式写 options.labels.optimize / labels.lineOptimize 的标签类别自动走避让 / 截断,显式 false 仍强制显示;线路动点与节点涟漪暂停;
8191
+ * 进入密集档后,未显式写 options.labels.optimize 的标签类别自动走避让 / 截断,显式 false 仍强制显示;线路动点与节点涟漪暂停;
7944
8192
  * 运行时用 updateOptions({ denseMode }) 切换,当前有效值与判定依据看 getStats().dense。
7945
8193
  */
7946
8194
  denseMode?: GisViewDenseModeInput
@@ -7967,21 +8215,13 @@ export interface GisViewOptions {
7967
8215
  */
7968
8216
  lineDirection?: GisViewLineDirectionInput | null
7969
8217
  /**
7970
- * 预热:把「这次画面会出现什么」提前告诉组件(节点符号 × 会出现的颜色 × 会出现的尺寸、
7971
- * 线路颜色 × 线路动画的图标),它在第一帧之前就把这些贴图与颜色烤好 ——
7972
- * 十万级数据下省掉的是「第一次画到这个组合」时的解码 + 光栅化那一下。
7973
- * 不配就是从前那条按需路径;运行时 runPrebake() 按当前配置再烤一遍、getPrebake() 读配置。
7974
- */
7975
- prebake?: GisViewPrebakeOptions | boolean | null
7976
- /**
7977
- * 规则预处理:开启后按启用中的 pointRules / lineRules 收集节点符号与线路装饰,
7978
- * 在首帧前提前走符号库。图片 / SVG / 自定义画笔会提前解码与光栅化;圆 / 长方形走
7979
- * 着色器距离场,只预热点元数据,不生成贴图。整批解析时还会按条件字段组合复用规则结果;
7980
- * 函数条件 / 自定义运算符与对象 / 数组字段自动退回逐要素求值。可写 true 或
7981
- * `{ enabled, symbols, decorations }`,`enabled` 同时控制两项能力。
7982
- * 运行时 updateOptions({ rulePreprocess }) 重跑,读数见 getRulePreprocess() / runRulePreprocess()。
8218
+ * 预处理 / 预热总配置:符号贴图、规则符号、交互索引 / 后备缓冲与搜索缓存共用这一个开关。
8219
+ * `true` / `'idle'` 全开并空闲执行;`'eager'` 全开并尽量在初始化 / 数据变化时当场执行;
8220
+ * 对象写法按项开启(`{ mode, symbols, rules, interaction, target, search }`)。
8221
+ * 不写时只保留「features 有交互能力就空闲建索引」的默认路径。
8222
+ * 运行时 updateOptions({ preprocess }) 换一份;规则 / 符号读数见 getRulePreprocess() / getPrebake()。
7983
8223
  */
7984
- rulePreprocess?: GisViewRulePreprocessInput
8224
+ preprocess?: GisViewPreprocessInput
7985
8225
  points?: GisViewPoint[]
7986
8226
  lines?: GisViewLine[]
7987
8227
  /** 通道:把若干条线路组织成并行敷设的多回线走廊 */
@@ -8007,6 +8247,7 @@ export interface GisViewOptions {
8007
8247
  * 热力上色、光晕与密度;显式 target 只门控这一类。不删除数据、不改筛选;
8008
8248
  * 只改图例配置仍只重画这一层,不触发引擎场景重排或标签重排
8009
8249
  */
8250
+ visualMap?: GisViewVisualMap | null
8010
8251
  /**
8011
8252
  * 与节点无关的扩展图形:在画布之上、标签之下绘制 SVG 路径 / 图片 / Canvas,
8012
8253
  * 支持世界坐标锚点、旋转、透明度、zIndex 与随视图缩放。运行时用 addGraphic / addGraphics /
@@ -8025,43 +8266,8 @@ export interface GisViewOptions {
8025
8266
  lineFollowsNode?: boolean
8026
8267
  /** 内置鹰眼图:不配就不显示,配了默认开 */
8027
8268
  minimap?: GisViewMinimapOptions | null
8028
- /** 筛选是否用 Worker 计算:默认在数据量超过阈值时自动启用,false 表示始终同步计算 */
8029
- filterWorker?: boolean | GisViewFilterWorkerOptions
8030
- /**
8031
- * 搜索是否用 Worker 计算(只影响 searchAsync):默认在点 + 线超过 20000 时自动启用,
8032
- * false 表示 searchAsync 也同步算,写对象可以调阈值(threshold 为 0 等同 false)。
8033
- * 同步的 search 一直都在主线程算,这个开关不影响它。
8034
- */
8035
- searchWorker?: boolean | GisViewSearchWorkerOptions
8036
- /**
8037
- * 数据就绪后是否在空闲期自动预加载搜索文本(默认 false):大表先交给 Worker 摊平,
8038
- * 小表按 4096 条一片在主线程摊平并让出帧;结构性换数据之后会重新排一次。
8039
- * 只把首次搜索的准备成本提前,不减少总工作量,也不影响同步 search 与 searchAsync 的结果口径。
8040
- * 关闭只停自动调度,仍可手动调用 preloadSearch()。
8041
- */
8042
- searchPreload?: boolean
8043
8269
  /** 筛选完成(含 Worker 异步返回)后回调 */
8044
8270
  onFilter?: (result: GisViewFilterResult) => void
8045
- /** 悬停样式:没有配置(且 defaultHighlight 为 false)时悬停不改变外观,只触发回调与提示 */
8046
- pointHoverStyle?: GisViewPointStyle
8047
- /** 点击选中后的样式:没有配置(且 defaultHighlight 为 false)时选中不改变外观,只改选中集合与回调 */
8048
- pointSelectStyle?: GisViewPointStyle
8049
- /** Ctrl 点击累加多选时的点样式:缺省沿用 pointSelectStyle,单个点可用 multiSelectStyle 覆盖 */
8050
- pointMultiSelectStyle?: GisViewPointStyle
8051
- /** 框选(Shift + 拖动,跟随 shortcuts.boxSelect)命中的点样式:缺省沿用 pointSelectStyle,单个点可用 boxSelectStyle 覆盖 */
8052
- pointBoxSelectStyle?: GisViewPointStyle
8053
- lineHoverStyle?: GisViewLineStyle
8054
- lineSelectStyle?: GisViewLineStyle
8055
- /** Ctrl 点击累加多选时的线样式:缺省沿用 lineSelectStyle,单条线可用 multiSelectStyle 覆盖 */
8056
- lineMultiSelectStyle?: GisViewLineStyle
8057
- /**
8058
- * 点击级联高亮(默认关):点击节点时亮起它和直接相连的节点;scope 为 both 时连线路一起亮,
8059
- * 点击线路 / 通道回线时亮起两端节点。它不进选中集,样式与悬停 / 选中分开配置,
8060
- * 当前亮起的清单用 getCascadeHighlight() 读;取消选中时同步收掉,不会留下级联残影。
8061
- */
8062
- cascadeHighlight?: GisViewCascadeHighlightInput
8063
- /** 没有配置状态样式时,是否仍用尺寸 / 宽度增幅画出内置强调;默认 false(不配样式就不改变外观) */
8064
- defaultHighlight?: boolean
8065
8271
  /** 节点整体放大系数(常数倍数,与地图缩放无关,屏幕上的大小因此恒定):与点自身 size、缩放联动一起相乘,默认 1 */
8066
8272
  pointSizeScale?: number
8067
8273
  /** 线路整体放大系数(常数倍数,与地图缩放无关):与线自身 width、缩放联动一起相乘,默认 1 */
@@ -8092,18 +8298,6 @@ export interface GisViewOptions {
8092
8298
  * 聚合期间发散初始化暂停;缩放超过 maxZoom 后恢复逐点显示。
8093
8299
  */
8094
8300
  pointCluster?: boolean | GisViewPointClusterOptions
8095
- /** 是否绘制网格:与其它功能开关同一条口径,**缺省关**,写 showGrid: true 才画 */
8096
- showGrid?: boolean
8097
- /**
8098
- * 网架整体显隐:false 时节点、线路、通道、装饰、动画与标签全部不画,只保留背景、网格与自定义 WebGL 层。
8099
- * 适合先铺数据、再加 / 调背景;缺省 true。运行时用 updateOptions({ networkVisible }) 一键切换。
8100
- */
8101
- networkVisible?: boolean
8102
- /**
8103
- * 网架整体不透明度(0 ~ 1,缺省 1):在每类要素自身 opacity 之后再乘一层,背景不受影响。
8104
- * 与 networkVisible 分开:要完全看不见用 networkVisible: false,只想压淡网架调这一项。
8105
- */
8106
- networkOpacity?: number
8107
8301
  /**
8108
8302
  * 背景编辑模式:true 时节点、线路、通道的悬停、点击、选中、拖拽、框选、右键与数据快捷键全部停用,
8109
8303
  * 但滚轮缩放照常可用,方便让网架和背景一起放大缩小后只调整背景。缺省 false。
@@ -8111,34 +8305,14 @@ export interface GisViewOptions {
8111
8305
  * 也可由使用方编辑界面自行调用 updateBackground() 完成。
8112
8306
  */
8113
8307
  backgroundEditing?: boolean
8114
- gridColor?: string
8115
- /** 网格线的屏幕目标间距(像素),实际步长吸附到 1 / 2 / 5 × 10^n */
8116
- gridSize?: number
8117
- /**
8118
- * 交互期细线快路径(默认开):平移 / 缩放期间,若视野里的线段都细到 3px 以内、且没有虚线,
8119
- * 整批线段换成 `gl.LINES` 画(1 设备像素)。十万级下省的是「每条线段两个细长三角形 × 4x MSAA」
8120
- * 那笔光栅化开销,代价是交互期线宽恒为 1 像素、虚线按实线画 —— 停手 160ms 后的那一帧恢复原样。
8121
- * 关掉之后交互期与静止帧完全一致,画面不会有任何变化(性能回落到这条快路径之前)。
8122
- */
8123
- interactionThinLines?: boolean
8124
- /**
8125
- * 非 MSAA 后备缓冲(交互 / 动画期,默认开):拖动 / 缩放 / 框选期间与动画在跑的那些帧,
8126
- * 整帧先画进一张不带 MSAA 的贴图,画完整幅贴回画布。
8127
- * MSAA 4× 会把十万级「细长三角形 × 互相重叠」那一笔光栅化放大近 5 倍(真机 ANGLE/AMD 实测:
8128
- * 同一次拖动 133 → 37 ms/帧、动画帧 212 → 53 ms/帧),这些帧本来就是轻量批次,
8129
- * 这一档换回来的是实打实的跟手;停手(或动画停帧)之后那一帧照旧直接画进带 MSAA 的画布,
8130
- * 静态画面一个像素都没变。
8131
- * 关掉之后交互 / 动画期与静止帧的画法完全一致(代价是十万级下慢 3 ~ 4 倍)。
8132
- */
8133
- interactionNoMsaa?: boolean
8134
8308
  /**
8135
- * 交互帧分辨率:`'auto'`(缺省)在节点 + 线路达到 50,000 时用 0.75 倍,小场景保持 1;
8136
- * 也可写 0.25 ~ 1 的固定倍率。只缩小交互 / 相机运动 / 动画帧的后备缓冲,停手后的静态帧
8137
- * 始终按完整分辨率重画;整幅贴回时用线性过滤,点径 / 线宽 / 描边 / 阴影偏移都按目标像素比换算,
8138
- * 视觉尺寸基本不变。目标缓冲的绝对像素比最低按 0.6 执行,所以 0.25 / 0.5 在 DPR 1 下也会停在 0.6。
8139
- * 透明底 / 自定义底色的导出帧不降采样;通道草稿使用 customDraw 时该帧也强制完整分辨率。
8309
+ * 背景事件(**缺省关**):true 一次打开 hover / click / dblClick / contextMenu,
8310
+ * 对象写法按项打开。开启后任意画布背景位置都参与指针拾取,GeoJSON 命中时载荷另带具体区域;
8311
+ * 数据要素命中优先,背景是回退目标。
8312
+ * 与 features.hover / features.contextMenu 相互独立,backgroundEditing 期间全部停用。
8313
+ * 运行时 updateOptions({ backgroundEvents }) 立即生效,关闭 hover 会补发 onBackgroundHover(null)。
8140
8314
  */
8141
- interactionResolution?: number | 'auto'
8315
+ backgroundEvents?: GisViewBackgroundEventsInput
8142
8316
  /**
8143
8317
  * 光标:按状态与悬停目标分别配置,写法支持 CSS 关键字与自定义图片(url / 热点),
8144
8318
  * 还能配按住 Ctrl / ⌘ 时的另一套。不配时用 network-view.css 里的 --network-view-cursor-* 变量
@@ -8161,6 +8335,7 @@ export interface GisViewOptions {
8161
8335
  * 打开时这类「双端都选中」的几何在拖动过程中每帧更新,即使 `liveDrag: false`;
8162
8336
  * 只连一端,或关掉本项时,仍按 `liveDrag` 的口径停手后补齐。运行时走 `updateOptions({ dragLinesWithNodes })`。
8163
8337
  */
8338
+ dragLinesWithNodes?: boolean
8164
8339
 
8165
8340
  /**
8166
8341
  * 快捷键:框选、多选、加点、复制、粘贴、取消、删除、适应视图都可以在这里改
@@ -8171,12 +8346,6 @@ export interface GisViewOptions {
8171
8346
  copy?: GisViewCopyOptions
8172
8347
  /** 合并节点(**缺省关**:写了这份配置才算开):把一个节点拖到另一个节点上(考虑碰撞)时怎么确认与怎么并 */
8173
8348
  merge?: GisViewMergeOptions
8174
- /** 拐点显示时机:selected 只在线路被选中(或刚加过拐点)时显示,always 始终显示;默认 selected */
8175
- waypointVisibility?: 'selected' | 'always'
8176
- /** 拐点样式,缺省为小圆点 */
8177
- waypointStyle?: GisViewPointStyle
8178
- /** 拐点被选中时的样式:没有配置(且 defaultHighlight 为 false)时选中不改变外观 */
8179
- waypointSelectStyle?: GisViewPointStyle
8180
8349
  /**
8181
8350
  * 相机比例下限(像素 / 世界单位),默认 0.002。
8182
8351
  * 写 'fit' 时按当前数据包围盒与 fitPadding 自动计算,缩到最小时至少能看见完整网架;
@@ -8196,19 +8365,11 @@ export interface GisViewOptions {
8196
8365
  */
8197
8366
  initialView?: GisViewInitialView | null
8198
8367
  /**
8199
- * 适应视图时按可见节点间距兜底(默认关):true 用精确的 minDistance 24,
8200
- * 对象在 minDistance / maxDistance 中二选一。只在首次默认适应与 fitView() 生效,
8201
- * 显式 initialView.scale / zoom 优先。
8368
+ * 适应视图时按可见节点间距兜底(默认关):true 用精确的 minDistance 24;
8369
+ * 对象在 minDistance / maxDistance 中二选一,restore 控制调整后是否回到普通适应比例。
8370
+ * 只在首次默认适应与 fitView() 生效,显式 initialView.scale / zoom 优先。
8202
8371
  */
8203
8372
  fitSpacing?: boolean | GisViewFitSpacingOptions
8204
- /**
8205
- * fitSpacing 调整后自动回到未启用 fitSpacing 的普通适应比例(默认关):
8206
- * true 用 450ms 平滑过渡,数字按毫秒指定时长,0 表示立即落位。
8207
- * 回位按地图缩放处理:只改相机比例,缩放基准与 resetView() 目标仍是 fitSpacing 落位比例,
8208
- * 节点 / 线宽会按 pointZoomScale / lineZoomScale 随这次回位变化。
8209
- * 只在 fitSpacing 真的改变了比例时生效;显式 initialView.scale / zoom 仍优先。
8210
- */
8211
- fitSpacingRestore?: boolean | number
8212
8373
  /**
8213
8374
  * onStats 的最小间隔(毫秒),默认 250,0 表示每帧都发。
8214
8375
  * 读数不需要 60Hz,节流能省下每帧一次的回调与对象分配(拖拽时尤其明显)。
@@ -8243,7 +8404,7 @@ export interface GisViewOptions {
8243
8404
  * 画布是否开 MSAA(多重采样抗锯齿),缺省开 —— 无 GPU 的软件光栅(远程桌面、被拉黑回落的
8244
8405
  * SwiftShader)下自动关掉:真机上实测 4x MSAA 会把十万级的「细长三角形」批放大近 5 倍
8245
8406
  * (12 万段同屏 38 → 192 ms/帧),软件光栅只会更贵,交互期这笔开销由细线快路径顶掉大半
8246
- * (见 interactionThinLines)。片元着色器本来就自带抗锯齿(点精灵的距离场、亚像素细线的像素吸附),
8407
+ * (见 interaction.thinLines)。片元着色器本来就自带抗锯齿(点精灵的距离场、亚像素细线的像素吸附),
8247
8408
  * 想强制打开/关闭就写布尔值,当前实际状态见 getStats().antialias。
8248
8409
  */
8249
8410
  antialias?: boolean
@@ -8258,7 +8419,6 @@ export interface GisViewOptions {
8258
8419
  * 等权限自动生成,关闭对应权限后不会再宣称可用。缺省关闭。
8259
8420
  */
8260
8421
  a11y?: GisViewA11yInput
8261
- ariaLabel?: string
8262
8422
  onReady?: (payload: GisViewReadyPayload) => void
8263
8423
  /**
8264
8424
  * 选中集实际变化时发:真实单击 / Ctrl 与 multiSelect 取反 / selectAt 与按引用接口同口径,
@@ -8303,6 +8463,14 @@ export interface GisViewOptions {
8303
8463
  /** 点击级联高亮变了:载荷与 getCascadeHighlight() 同一份,收掉时是 null */
8304
8464
  onCascadeHighlight?: (payload: GisViewCascadeHighlightInfo | null) => void
8305
8465
  onHover?: (payload: GisViewHoverPayload) => void
8466
+ /** 背景悬停:进入 / 换目标发载荷(GeoJSON 命中时带 region,空白背景为 null),离开、关闭 hover、切换背景或进入背景编辑时发 null */
8467
+ onBackgroundHover?: (payload: GisViewBackgroundEventPayload | null) => void
8468
+ /** 背景单击(只在没有数据要素 / 保留框命中时发;空白背景 region 为 null);双击的第二下也照常发这一条 */
8469
+ onBackgroundClick?: (payload: GisViewBackgroundEventPayload) => void
8470
+ /** 背景双击第二下(空白背景 region 为 null);与 click 独立开关,只开 dblClick 也能收到 */
8471
+ onBackgroundDblClick?: (payload: GisViewBackgroundEventPayload) => void
8472
+ /** 背景右键(空白背景 region 为 null);只在没有数据要素命中时发,系统菜单仍按 preventContextMenu 处理 */
8473
+ onBackgroundContextMenu?: (payload: GisViewBackgroundEventPayload) => void
8306
8474
  onCursor?: (payload: GisViewCursorPayload) => void
8307
8475
  /** 光标移动 / 移出画布:屏幕坐标、世界坐标与经纬度(配了 GeoJSON 底图才有 lngLat) */
8308
8476
  onPointer?: (payload: GisViewPointerState) => void
@@ -9450,7 +9618,7 @@ export interface GisViewInstance {
9450
9618
  /**
9451
9619
  * 预加载搜索文本:数据量大且 searchWorker 开启时交给 Worker,否则按主线程分片摊平缓存。
9452
9620
  * 只提前做搜索准备,不改数据、不改筛选、也不动视角;返回这一趟走的路径、条目数与耗时。
9453
- * 自动调度由 options.searchPreload 控制,手动调用不受该开关限制。
9621
+ * 自动调度由 options.preprocess.search 控制,手动调用不受该开关限制。
9454
9622
  */
9455
9623
  preloadSearch(): Promise<GisViewSearchPreloadResult>
9456
9624
  setCamera(camera: Partial<GisViewCamera>): GisViewInstance
@@ -9508,15 +9676,15 @@ export interface GisViewInstance {
9508
9676
  * 位置取的是实例缓冲里那一份 —— 拖动就地挪过圈,所以读到的总是动画真正画在哪儿
9509
9677
  */
9510
9678
  getPointEffects(): GisViewPointEffectReadout[]
9511
- /** 预热配置读数:这次配了哪些符号 / 颜色 / 尺寸 / 逐组合(没配预热是 null) */
9679
+ /** 符号预处理读数:这次配了哪些符号 / 颜色 / 尺寸 / 逐组合(没开 preprocess.symbols 是 null) */
9512
9680
  getPrebake(): GisViewPrebakeReadout | null
9513
- /** 按当前预热配置再烤一遍,返回这一次解析了多少条组合(没配预热是 0) */
9681
+ /** 按当前符号预处理配置再烤一遍,返回这一次解析了多少条组合(没开是 0) */
9514
9682
  runPrebake(): number
9515
9683
  /** 规则预处理读数:开关、启用规则数、组合总数与贴图 / 着色器形状各多少 */
9516
9684
  getRulePreprocess(): GisViewRulePreprocessReadout
9517
9685
  /** 按当前规则表再跑一遍规则预处理,返回解析的符号组合数(关闭时 0) */
9518
9686
  runRulePreprocess(): number
9519
- /** 收出这份数据真正会用到的贴图组合:喂给 prebake.combos 就是不重不漏的一份(见「贴图符号预热」) */
9687
+ /** 收出这份数据真正会用到的贴图组合:喂给 preprocess.symbols.combos 就是不重不漏的一份(见「符号预处理」) */
9520
9688
  getSymbolCombos(): GisViewSymbolCombos
9521
9689
  getStats(): GisViewEngineStats
9522
9690
  /**
@@ -9589,6 +9757,13 @@ export interface GisViewInstance {
9589
9757
  */
9590
9758
  mapLngLatToData<T extends { points?: GisViewPoint[]; lines?: GisViewLine[]; channels?: GisViewChannel[] }>(data: T, options?: GisViewGeoMapperOptions): T | null
9591
9759
  pick(x: number, y: number): GisViewHitResult | null
9760
+ /**
9761
+ * 背景 GeoJSON 区域拾取(画布 CSS 像素):返回命中区域、世界坐标 / 屏幕坐标、填充 / 描边读数与 lngLat。
9762
+ * 与数据要素拾取分开,networkVisible: false 或 clickable: false 也照常可用;空白处返回 null。只读。
9763
+ */
9764
+ pickBackground(x: number, y: number): GisViewBackgroundPickResult | null
9765
+ /** pickBackground 的客户端坐标版本:参数就是鼠标事件的 clientX / clientY */
9766
+ pickBackgroundAt(clientX: number, clientY: number): GisViewBackgroundPickResult | null
9592
9767
  /**
9593
9768
  * 按浏览器客户端坐标拾取(鼠标事件里的 clientX / clientY):与指针事件载荷同一份读数,另加 target
9594
9769
  * ('point' / 'line' / 'channel')与 lngLat(配了 GeoJSON 底图才有);没命中返回 null。
@@ -9642,7 +9817,7 @@ export interface GisViewInstance {
9642
9817
  /**
9643
9818
  * 选中一个拐点:`selectWaypoint('line-1', 2)` / `selectWaypoint({ lineIndex: 3, pathIndex: 1 })` /
9644
9819
  * `selectWaypoint({ lineId: 'line-1', pathIndex: 2 })`。同时把拐点所在线路选上(缺省
9645
- * `waypointVisibility: 'selected'` 下拐点才可见);`selectWaypoint(null)` 只取消拐点选中,
9820
+ * `waypoint.visibility: 'selected'` 下拐点才可见);`selectWaypoint(null)` 只取消拐点选中,
9646
9821
  * 不改要素选中集。`pathIndex` 只认 `getWaypoints()` 给出的可编辑拐点,无效时不会猜位置。
9647
9822
  */
9648
9823
  selectWaypoint(waypoint: GisViewWaypointKey | GisViewWaypointRef | string | number | null, pathIndex?: number, options?: GisViewSelectOptions): GisViewInstance
@@ -9684,7 +9859,7 @@ export interface GisViewInstance {
9684
9859
  getSelectionData(): GisViewSelectionData
9685
9860
  /**
9686
9861
  * 当前点击级联高亮的读数:来源、scope 与亮着的节点 / 线路;没有级联高亮(或功能关着)时是 null。
9687
- * 它只读,不改变选中集;取消选中、点空白处、换数据或关掉 cascadeHighlight 会收掉。
9862
+ * 它只读,不改变选中集;取消选中、点空白处、换数据或关掉 highlight.cascade 会收掉。
9688
9863
  */
9689
9864
  getCascadeHighlight(): GisViewCascadeHighlightInfo | null
9690
9865
  /** 按画布 CSS 像素矩形框选;options 里的 selectionKinds 可临时覆盖全局 options.selection.kinds */
@@ -10407,7 +10582,7 @@ export interface GisViewEngineOptions {
10407
10582
  lineSelectStyle?: GisViewLineStyle | null
10408
10583
  /** Ctrl 点击累加多选时的线样式:缺省沿用 lineSelectStyle */
10409
10584
  lineMultiSelectStyle?: GisViewLineStyle | null
10410
- /** 点击级联高亮:true / 对象打开,false / null 关闭;详细写法见 GisViewOptions.cascadeHighlight */
10585
+ /** 点击级联高亮:true / 对象打开,false / null 关闭;详细写法见 GisViewOptions.highlight.cascade */
10411
10586
  cascadeHighlight?: GisViewCascadeHighlightInput | null
10412
10587
  /** 没有配置状态样式时是否仍画内置强调(尺寸 / 宽度增幅与强调环);默认 false */
10413
10588
  defaultHighlight?: boolean
@@ -10429,22 +10604,22 @@ export interface GisViewEngineOptions {
10429
10604
  initialView?: GisViewInitialView | null
10430
10605
  /** 适应视图的节点间距兜底:true 用 minDistance 24,对象在 minDistance / maxDistance 中二选一,默认关 */
10431
10606
  fitSpacing?: boolean | GisViewFitSpacingOptions
10432
- /** 间距调整后自动按地图缩放回普通适应比例:true=450ms,数字=毫秒,0=立即,默认关;缩放基准仍保留间距落位比例 */
10433
- fitSpacingRestore?: boolean | number
10434
10607
  /** onStats 的最小间隔(毫秒),默认 250,0 表示每帧都发 */
10435
10608
  statsInterval?: number
10436
10609
  /** 画质:档位名或 `{ mode, budgetMs, minScale }`(见 GisViewQualityOptions),只影响画哪些批次与分辨率 */
10437
10610
  quality?: GisViewQualityOptions
10438
10611
  gridColor?: string
10439
10612
  gridSize?: number
10440
- /** 是否绘制网格,**缺省关**(见 GisViewOptions.showGrid) */
10613
+ /** 是否绘制网格,**缺省关**(见 GisViewOptions.grid) */
10441
10614
  showGrid?: boolean
10442
- /** 网架整体显隐,**缺省开**(见 GisViewOptions.networkVisible):false 时只留背景、网格与自定义 WebGL 层 */
10615
+ /** 网架整体显隐,**缺省开**(见 GisViewOptions.network):false 时只留背景、网格与自定义 WebGL 层 */
10443
10616
  networkVisible?: boolean
10444
10617
  /** 网架整体不透明度(0 ~ 1,缺省 1),在逐要素 opacity 之后相乘;背景不受影响 */
10445
10618
  networkOpacity?: number
10446
10619
  /** 背景编辑模式(见 GisViewOptions.backgroundEditing):true 时屏蔽网架指针与数据快捷键,仅保留滚轮缩放 */
10447
10620
  backgroundEditing?: boolean
10621
+ /** 背景事件:true 全开,对象逐项打开;缺省全关,空白背景也会触发(见 GisViewOptions.backgroundEvents) */
10622
+ backgroundEvents?: GisViewBackgroundEventsInput
10448
10623
  /** 引擎内部总闸:组件层固定为 true,具体权限由 features 换算出的 pan / zoom / contextMenu 等字段决定 */
10449
10624
  interactive?: boolean
10450
10625
  /** 引擎内部总闸:组件层固定为 true,具体权限由 features 换算出的 hover / select 等字段决定 */
@@ -10507,8 +10682,8 @@ export interface GisViewEngineOptions {
10507
10682
  channelHiddenLineLayout?: GisViewChannelHiddenLineLayout
10508
10683
  /** 线路是否跟随节点,缺省 true;关闭后节点退场时线路 / 通道停在最后一份坐标与解析尺寸 */
10509
10684
  lineFollowsNode?: boolean
10510
- /** 规则预处理配置,见 GisViewOptions.rulePreprocess */
10511
- rulePreprocess?: GisViewRulePreprocessInput
10685
+ /** 预处理总配置,见 GisViewOptions.preprocess */
10686
+ preprocess?: GisViewPreprocessInput
10512
10687
 
10513
10688
  /** 快捷键:动作 -> 写法(框选、多选、加点、复制、粘贴、取消、删除、适应视图),没写的沿用默认值 */
10514
10689
  shortcuts?: GisViewShortcuts
@@ -10534,15 +10709,20 @@ export interface GisViewEngineOptions {
10534
10709
  pixelRatio?: number
10535
10710
  /** 画布是否开 MSAA,缺省开(软件光栅下自动关):写布尔值可强制,读数见 getStats().antialias */
10536
10711
  antialias?: boolean
10537
- /** 非 MSAA 后备缓冲(交互 / 动画期),默认开(见 GisViewOptions.interactionNoMsaa) */
10712
+ /** 非 MSAA 后备缓冲(交互 / 动画期),默认开(见 GisViewOptions.interaction.noMsaa) */
10538
10713
  interactionNoMsaa?: boolean
10539
- /** 交互期细线快路径,默认开(见 GisViewOptions.interactionThinLines) */
10714
+ /** 交互期细线快路径,默认开(见 GisViewOptions.interaction.thinLines) */
10540
10715
  interactionThinLines?: boolean
10541
- /** 交互帧分辨率:'auto' / 0.25 ~ 1,见 GisViewOptions.interactionResolution */
10716
+ /** 交互帧分辨率:'auto' / 0.25 ~ 1,见 GisViewOptions.interaction.resolution */
10542
10717
  interactionResolution?: number | 'auto'
10543
10718
  onCameraChange?: (camera: GisViewCamera) => void
10544
10719
  onCursor?: (coordinate: [number, number] | null) => void
10545
10720
  onHover?: (payload: GisViewHoverPayload) => void
10721
+ /** 背景悬停;离开 / 关闭时载荷为 null,空白背景的 region 为 null */
10722
+ onBackgroundHover?: (payload: GisViewBackgroundEventPayload | null) => void
10723
+ onBackgroundClick?: (payload: GisViewBackgroundEventPayload) => void
10724
+ onBackgroundDblClick?: (payload: GisViewBackgroundEventPayload) => void
10725
+ onBackgroundContextMenu?: (payload: GisViewBackgroundEventPayload) => void
10546
10726
  /**
10547
10727
  * 选中集实际变化时发:真实点击 / Ctrl 多选 / 空白清空、selectAt 与 selectFeatures / deselect /
10548
10728
  * focusOn({ select }) 等入口同口径;重复点击同一要素保持静默。框选(含 selectInBox)是例外:
@@ -10824,15 +11004,15 @@ export interface GisViewEngine {
10824
11004
  getLineEffects(): GisViewLineEffectReadout[]
10825
11005
  /** 节点涟漪这一帧的读数(世界坐标 + 颜色 + 半径 + 圈数):视野里没有涟漪时是空表 */
10826
11006
  getPointEffects(): GisViewPointEffectReadout[]
10827
- /** 预热配置读数(没配预热是 null) */
11007
+ /** 符号预处理读数(没开 preprocess.symbols 是 null) */
10828
11008
  getPrebake(): GisViewPrebakeReadout | null
10829
- /** 按当前预热配置再烤一遍,返回这次解析了多少条组合(没配预热是 0) */
11009
+ /** 按当前符号预处理配置再烤一遍,返回这次解析了多少条组合(没开是 0) */
10830
11010
  runPrebake(): number
10831
11011
  /** 规则预处理读数:开关、启用规则数、组合总数与贴图 / 着色器形状各多少 */
10832
11012
  getRulePreprocess(): GisViewRulePreprocessReadout
10833
11013
  /** 按当前规则表再跑一遍规则预处理,返回解析的符号组合数(关闭时 0) */
10834
11014
  runRulePreprocess(): number
10835
- /** 收出这份数据真正会用到的贴图组合(喂给 prebake.combos 就是不重不漏的一份) */
11015
+ /** 收出这份数据真正会用到的贴图组合(喂给 preprocess.symbols.combos 就是不重不漏的一份) */
10836
11016
  getSymbolCombos(): GisViewSymbolCombos
10837
11017
  /** 画质档位读数:当前实际在哪一档(自动档升降之后)与最近一帧的渲染耗时 */
10838
11018
  quality: GisViewQualityState
@@ -10848,6 +11028,10 @@ export interface GisViewEngine {
10848
11028
  /** 世界坐标 → 客户端坐标(摆 DOM 浮层 / 菜单用) */
10849
11029
  worldToClient(x: number, y: number): [number, number]
10850
11030
  pick(x: number, y: number): GisViewHitResult | null
11031
+ /** 与组件实例的 pickBackground 同一份:背景 GeoJSON 区域拾取(画布 CSS 像素) */
11032
+ pickBackground(x: number, y: number): GisViewBackgroundPickResult | null
11033
+ /** 与组件实例的 pickBackgroundAt 同一份:按浏览器客户端坐标拾取背景区域 */
11034
+ pickBackgroundAtClient(clientX: number, clientY: number): GisViewBackgroundPickResult | null
10851
11035
  /** 与组件实例的 pickAt 同一份:按浏览器客户端坐标拾取(引擎不等 DOM 事件,直接给 clientX / clientY) */
10852
11036
  pickAtClient(clientX: number, clientY: number): GisViewHitResult | null
10853
11037
  /** 与组件实例的 selectAt 同一份:按客户端坐标走一次普通单击选中(通道按 options.channel.selectMode 摊开) */