@ray-js/robot-map-sdk 0.0.5-beta.4 → 0.0.6-beta.1

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.
Files changed (31) hide show
  1. package/dist/index.d.ts +78 -42
  2. package/dist/index.rjs.js +1 -1
  3. package/dist-app/assets/{index-DXwi5Z5p.js → index-6QJHxb0C.js} +1 -1
  4. package/dist-app/index.html +1 -1
  5. package/dist-docs/404.html +2 -2
  6. package/dist-docs/assets/{app.ImNciwLP.js → app.BkKV_ucc.js} +1 -1
  7. package/dist-docs/assets/chunks/@localSearchIndexroot.BlqvVSiD.js +1 -0
  8. package/dist-docs/assets/chunks/{VPLocalSearchBox.BRkuUFv4.js → VPLocalSearchBox.BDtfnT2I.js} +1 -1
  9. package/dist-docs/assets/chunks/{theme.8Y64nJoP.js → theme.BgDHzlGk.js} +2 -2
  10. package/dist-docs/assets/{guide_advanced-usage.md.DO2hzf-K.js → guide_advanced-usage.md.N6C1_tsi.js} +29 -18
  11. package/dist-docs/assets/{guide_advanced-usage.md.DO2hzf-K.lean.js → guide_advanced-usage.md.N6C1_tsi.lean.js} +1 -1
  12. package/dist-docs/assets/{guide_getting-started.md.DJv5kQ1V.js → guide_getting-started.md.B66M-nsN.js} +1 -1
  13. package/dist-docs/assets/{reference_config.md.BmBJ-w7k.js → reference_config.md.CMS6rl81.js} +3 -3
  14. package/dist-docs/assets/{reference_config.md.BmBJ-w7k.lean.js → reference_config.md.CMS6rl81.lean.js} +1 -1
  15. package/dist-docs/assets/{reference_methods.md.DGVZpJAe.js → reference_methods.md.BNxMKwmx.js} +8 -3
  16. package/dist-docs/assets/{reference_methods.md.DGVZpJAe.lean.js → reference_methods.md.BNxMKwmx.lean.js} +1 -1
  17. package/dist-docs/guide/advanced-usage.html +33 -22
  18. package/dist-docs/guide/concepts.html +3 -3
  19. package/dist-docs/guide/getting-started.html +5 -5
  20. package/dist-docs/hashmap.json +1 -1
  21. package/dist-docs/index.html +3 -3
  22. package/dist-docs/reference/callbacks.html +3 -3
  23. package/dist-docs/reference/config.html +6 -6
  24. package/dist-docs/reference/data.html +3 -3
  25. package/dist-docs/reference/methods.html +11 -6
  26. package/dist-docs/reference/runtime.html +3 -3
  27. package/dist-docs/reference/types.html +3 -3
  28. package/dist-docs/reference/utils.html +3 -3
  29. package/package.json +1 -1
  30. package/dist-docs/assets/chunks/@localSearchIndexroot.BnEnKmCZ.js +0 -1
  31. /package/dist-docs/assets/{guide_getting-started.md.DJv5kQ1V.lean.js → guide_getting-started.md.B66M-nsN.lean.js} +0 -0
package/dist/index.d.ts CHANGED
@@ -69,6 +69,8 @@ export declare type AppConfig = {
69
69
  smoothIterations: number
70
70
  /** 热力图透明度 */
71
71
  heatmapAlpha: number
72
+ /** 是否使用渐变 */
73
+ useGradient: boolean
72
74
  /** 颜色渐变配置 */
73
75
  colorGradients: [
74
76
  ColorSource,
@@ -475,6 +477,8 @@ export declare type AppConfig = {
475
477
  declare class AppContainer extends Container {
476
478
  private layers;
477
479
  private mapRotation;
480
+ private backgroundGraphics;
481
+ private lastBackgroundState;
478
482
  constructor();
479
483
  /**
480
484
  * 初始化所有预定义的层级
@@ -535,6 +539,17 @@ declare class AppContainer extends Container {
535
539
  * @returns 旋转角度(弧度)
536
540
  */
537
541
  getMapRotationRadians(): number;
542
+ /**
543
+ * 获取用于截图的完整边界
544
+ * 会合并所有可见图层的局部边界,确保截图能覆盖所有内容(包括超出初始地图范围的禁区等)
545
+ */
546
+ getSnapshotBounds(): Rectangle;
547
+ /**
548
+ * 更新截图背景(主渲染器显示版本)
549
+ * @param color 背景颜色
550
+ * @param visible 是否可见
551
+ */
552
+ updateBackground(color: ColorSource, visible: boolean): void;
538
553
  }
539
554
 
540
555
  /**
@@ -610,7 +625,7 @@ export declare type BaseCustomElementParam = {
610
625
  /** 是否可交互 */
611
626
  interactive?: boolean
612
627
  /** 自定义数据 */
613
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
628
+
614
629
  customData?: Record<string, any>
615
630
  /** 尺寸是否固定 */
616
631
  sizeFixed?: boolean
@@ -1289,7 +1304,7 @@ export declare type CustomCarpetParam = {
1289
1304
  points?: Point[]
1290
1305
 
1291
1306
  /** 形状 */
1292
- shape: 'rectangle' | 'round' | 'custom',
1307
+ shape: 'rectangle' | 'round' | 'custom'
1293
1308
 
1294
1309
  /** 自定义数据 */
1295
1310
  customData?: Record<string, any>
@@ -1428,7 +1443,7 @@ export declare type DetectedObjectParam = {
1428
1443
  /** 宽度 */
1429
1444
  width?: number
1430
1445
  /** 自定义数据 */
1431
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
1446
+
1432
1447
  customData?: Record<string, any>
1433
1448
  }
1434
1449
 
@@ -2078,10 +2093,7 @@ declare class Heatmap extends Container {
2078
2093
  y: number;
2079
2094
  signal: number;
2080
2095
  hasPoint: boolean;
2081
- }>>, useGradient?: boolean, heatmapAlpha?: number, offset?: {
2082
- x: number;
2083
- y: number;
2084
- }): void;
2096
+ }>>, heatmapAlpha?: number): void;
2085
2097
  /**
2086
2098
  * 裁剪热力图 仅显示房间区域
2087
2099
  * 根据roomFill图层的子元素 组合Graphics生成大Graphics裁剪
@@ -2125,25 +2137,33 @@ declare class HeatmapManager {
2125
2137
  maxDistance: number;
2126
2138
  smoothIterations: number;
2127
2139
  heatmapAlpha: number;
2140
+ isHeatmapDrawn: boolean;
2141
+ private loadTimer;
2128
2142
  constructor();
2129
2143
  /**
2130
2144
  * 绘制热力图
2131
2145
  * @param mapData 地图数据
2132
2146
  * @param heatmapPoints 热力图点
2133
- * @param useGradient 是否使用渐变绘制
2134
2147
  * @returns
2135
2148
  */
2136
- draw({ mapData, heatmapPoints, useGradient, }: {
2137
- mapData: MapDataSource;
2138
- heatmapPoints: HeatmapPoint[];
2139
- useGradient?: boolean;
2140
- }): void;
2149
+ private pendingPoints;
2150
+ /**
2151
+ * 绘制热力图
2152
+ * @param mapData 地图数据
2153
+ * @param heatmapPoints 热力图点
2154
+ * @returns
2155
+ */
2156
+ draw(heatmapPoints: HeatmapPoint[]): void;
2157
+ /**
2158
+ * 地图加载完成回调
2159
+ */
2160
+ onMapLoaded(): void;
2141
2161
  /**
2142
2162
  * 插值计算信号网格
2143
2163
  * @param pointsTopLeftOrigin 热力图路径点
2144
2164
  * @returns 信号网格
2145
2165
  */
2146
- calculateInterpolatedSignal(pointsTopLeftOrigin: HeatmapPoint[], mapData: MapDataSource): {
2166
+ calculateInterpolatedSignal(pointsTopLeftOrigin: HeatmapPoint[]): {
2147
2167
  x: number;
2148
2168
  y: number;
2149
2169
  signal: number;
@@ -2407,6 +2427,8 @@ export declare const MAP_CALLBACK_METHODS: readonly ["onMapFirstDrawed", "onMapD
2407
2427
  *
2408
2428
  */
2409
2429
  export declare interface MapApi {
2430
+ /** 地图是否绘制完成 */
2431
+ isMapDrawn: boolean;
2410
2432
  /**
2411
2433
  * 重置地图的平移和缩放状态
2412
2434
  *
@@ -2624,28 +2646,35 @@ export declare interface MapApi {
2624
2646
  /**
2625
2647
  * 地图截图
2626
2648
  *
2627
- * 将当前地图状态导出为图片,支持多种格式和质量设置。
2649
+ * 将当前地图状态导出为图片。截图过程中会自动添加一个临时的背景层,
2650
+ * 确保禁区等半透明元素在截图中能够正确显示颜色。
2628
2651
  *
2629
- * @returns Promise<string> Base64 格式的图片数据
2652
+ * @param options - 截图配置选项
2653
+ * @param options.backgroundColor - 指定截图时的背景颜色。若不指定,将默认使用 `global.config.backgroundColor`。支持颜色字符串、十六进制数值或 RGB 数组。
2654
+ * @returns Promise<string> Base64 格式的图片数据 (Data URL)
2630
2655
  */
2631
- snapshot(): Promise<string>;
2656
+ snapshot(options?: {
2657
+ backgroundColor?: ColorSource;
2658
+ }): Promise<string>;
2632
2659
  /**
2633
- * 使用其他地图数据进行截图
2660
+ * 使用自定义地图数据生成截图
2634
2661
  *
2635
- * 基于提供的地图数据生成截图,主要用于多地图场景或预览功能。
2636
- * 不会影响当前地图的显示状态。
2662
+ * 基于提供的地图、路径、区域等数据生成截图,通常用于多地图管理界面的缩略图预览。
2663
+ * 此方法会创建一个临时的离屏渲染实例,不会影响当前正在运行的地图显示状态。
2637
2664
  *
2638
- * @param data - 地图数据对象
2639
- * @param data.map - 地图字符串数据
2640
- * @param data.path - 可选的路径数据
2641
- * @param data.roomProperties - 可选的房间属性数据
2642
- * @param data.customElements - 可选的自定义元素数据
2643
- * @param data.forbiddenSweepZones - 可选的禁扫区域数据
2644
- * @param data.forbiddenMopZones - 可选的禁拖区域数据
2645
- * @param data.virtualWalls - 可选的虚拟墙数据
2646
- * @param data.detectedObjects - 可选的检测物体数据
2647
- * @param runtime - 可选的运行时配置
2648
- * @returns Promise<string> Base64 格式的图片数据
2665
+ * @param data - 包含地图、路径、区域等完整状态的数据对象
2666
+ * @param data.map - 地图原始字符串数据 (支持结构化协议和栅格协议)
2667
+ * @param data.path - 可选的路径协议字符串
2668
+ * @param data.roomProperties - 可选的房间属性数据数组
2669
+ * @param data.customElements - 可选的自定义元素数组
2670
+ * @param data.forbiddenSweepZones - 可选的禁扫区域数组
2671
+ * @param data.forbiddenMopZones - 可选的禁拖区域数组
2672
+ * @param data.virtualWalls - 可选的虚拟墙数组
2673
+ * @param data.detectedObjects - 可选的 AI 物体检测数据数组
2674
+ * @param runtime - 可选的运行时配置 (如是否显示机器人、充电桩等状态)
2675
+ * @param options - 截图配置选项
2676
+ * @param options.backgroundColor - 指定生成截图时的背景颜色。若不指定,将默认使用 `global.config.backgroundColor`。
2677
+ * @returns Promise<string> Base64 格式的图片数据 (Data URL)
2649
2678
  */
2650
2679
  snapshotByData(data: {
2651
2680
  map: string;
@@ -2656,7 +2685,9 @@ export declare interface MapApi {
2656
2685
  forbiddenMopZones?: ZoneParam[];
2657
2686
  virtualWalls?: VirtualWallParam[];
2658
2687
  detectedObjects?: DetectedObjectParam[];
2659
- }, runtime?: DeepPartialRuntimeConfig): Promise<string>;
2688
+ }, runtime?: DeepPartialRuntimeConfig, options?: {
2689
+ backgroundColor?: ColorSource;
2690
+ }): Promise<string>;
2660
2691
  }
2661
2692
 
2662
2693
  /**
@@ -2681,6 +2712,8 @@ declare class MapApplication extends Application implements MapApi {
2681
2712
  /* Excluded from this release type: tickerState */
2682
2713
  private pendingAsyncRender;
2683
2714
  private isFirstMapDraw;
2715
+ /** 地图是否绘制完成 */
2716
+ isMapDrawn: boolean;
2684
2717
  /* Excluded from this release type: __constructor */
2685
2718
  /**
2686
2719
  * 初始化地图应用
@@ -2753,11 +2786,7 @@ declare class MapApplication extends Application implements MapApi {
2753
2786
  * @returns void
2754
2787
  *
2755
2788
  */
2756
- drawHeatmap({ mapData, heatmapPoints, useGradient, }: {
2757
- mapData: MapDataSource;
2758
- heatmapPoints: HeatmapPoint[];
2759
- useGradient?: boolean;
2760
- }): void;
2789
+ drawHeatmap(heatmapPoints: HeatmapPoint[]): void;
2761
2790
  /**
2762
2791
  * 绘制禁扫区域
2763
2792
  * @param zones - 禁扫区域参数数组
@@ -3094,12 +3123,17 @@ declare class MapApplication extends Application implements MapApi {
3094
3123
  /**
3095
3124
  * 地图截图
3096
3125
  *
3097
- * 将当前地图状态导出为图片,支持多种格式和质量设置。
3126
+ * 将当前地图状态导出为图片。截图过程中使用离屏渲染技术,
3127
+ * 确保禁区等半透明元素在截图中能够正确显示颜色,同时避免主视图闪烁。
3098
3128
  *
3099
- * @returns Promise<string> Base64 格式的图片数据
3129
+ * @param options - 截图配置选项
3130
+ * @param options.backgroundColor - 指定截图时的背景颜色。若不指定,将默认使用 `global.config.backgroundColor`。支持颜色字符串、十六进制数值或 RGB 数组。
3131
+ * @returns Promise<string> Base64 格式的图片数据 (Data URL)
3100
3132
  *
3101
3133
  */
3102
- snapshot(): Promise<string>;
3134
+ snapshot(options?: {
3135
+ backgroundColor?: ColorSource;
3136
+ }): Promise<string>;
3103
3137
  /**
3104
3138
  * 使用其他地图数据进行截图
3105
3139
  *
@@ -3128,7 +3162,9 @@ declare class MapApplication extends Application implements MapApi {
3128
3162
  forbiddenMopZones?: ZoneParam[];
3129
3163
  virtualWalls?: VirtualWallParam[];
3130
3164
  detectedObjects?: DetectedObjectParam[];
3131
- }, runtime?: DeepPartialRuntimeConfig): Promise<string>;
3165
+ }, runtime?: DeepPartialRuntimeConfig, options?: {
3166
+ backgroundColor?: ColorSource;
3167
+ }): Promise<string>;
3132
3168
  /* Excluded from this release type: renderOnce */
3133
3169
  /* Excluded from this release type: renderOnceNextFrame */
3134
3170
  /* Excluded from this release type: requestRender */
@@ -4424,7 +4460,7 @@ export declare type RoomProperty = {
4424
4460
  /** 拖地模式 */
4425
4461
  yMop: number
4426
4462
  /** 自定义数据 */
4427
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
4463
+
4428
4464
  customData?: Record<string, any>
4429
4465
  }
4430
4466