@fleet-frontend/mower-maps 0.2.5-beta.3 → 0.2.5-beta.4

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/README.md CHANGED
@@ -1 +1,39 @@
1
- 暂无
1
+ # Mower Maps
2
+
3
+ ## 放大镜功能介绍
4
+
5
+ 放大镜用于在编辑禁区顶点时,提供局部放大预览,帮助用户更精准地拖拽点位并对齐底图。
6
+
7
+ ### 功能特点
8
+
9
+ - 仅在 `H5` 平台显示(`platform === PlatformType.H5`)。
10
+ - 拖拽禁区顶点时自动出现,结束拖拽后自动隐藏。
11
+ - 放大镜位置会根据拖拽点自动切换左右,尽量避免遮挡编辑区域。
12
+ - 使用圆形镜片样式,默认尺寸 `130px`,白色边框 `2px`。
13
+ - 放大镜内禁区点和线会增强显示,便于观察与操作。
14
+
15
+ ### 底图渲染方式
16
+
17
+ 放大镜底图优先使用 Google Static Maps API,按当前地图视口生成静态背景图,再与 SVG 图层一起渲染,保证编辑点与底图尽量对齐。
18
+
19
+ 为避免在 npm 包中暴露密钥,静态地图 API Key 需要由业务侧传入:
20
+
21
+ - 配置名:`googleMapStaticApiKey`
22
+ - 位置:`MowerMapRenderer` 组件 props
23
+
24
+ ### 使用方式
25
+
26
+ ```tsx
27
+ <MowerMapRenderer
28
+ platform={PlatformType.H5}
29
+ mapJson={mapData}
30
+ pathJson={pathData}
31
+ googleMapStaticApiKey={process.env.REACT_APP_GOOGLE_STATIC_MAP_KEY}
32
+ // ...其他配置
33
+ />
34
+ ```
35
+
36
+ ### 注意事项
37
+
38
+ - 若未传 `googleMapStaticApiKey`,放大镜将无法请求静态底图。
39
+ - 外部项目使用新字段前,请确保已安装包含最新类型声明的包版本(避免出现“字段不存在”的 TS/ESLint 报错)。
@@ -19,38 +19,73 @@ interface CommonContextType {
19
19
  drag: {
20
20
  x?: number;
21
21
  y?: number;
22
+ rotate?: number;
22
23
  rotation?: number;
23
24
  };
24
25
  mapRef: any;
25
26
  overlayScale?: number;
26
27
  showStraddleBoundaryBorder?: boolean;
27
28
  doodleList?: any[];
29
+ overlayLayout?: Record<string, any> | null;
30
+ bounds?: any;
31
+ googleMapStaticApiKey?: string;
32
+ onH5FirstSelectObstaclePoint?: () => void;
28
33
  }
29
34
  export declare const CommonContext: import("react").Context<{
30
35
  sn: string;
31
36
  editMap: boolean;
32
- mowerIconConfig: {};
37
+ mowerIconConfig: {
38
+ mapImgUrl: string;
39
+ mapDisabledUrl: string;
40
+ mapNoPositionUrl: string;
41
+ };
33
42
  platform: PlatformType;
34
43
  svgViewBox: any;
35
44
  unitType: UnitsType;
45
+ mapConfig: {};
46
+ mapJson: any;
47
+ drag: {
48
+ x: number;
49
+ y: number;
50
+ rotate: number;
51
+ rotation: number;
52
+ };
36
53
  mapRef: any;
54
+ bounds: any;
37
55
  globalHeight: number;
38
56
  heightOptions: any[];
39
57
  overlayScale: number;
40
58
  showStraddleBoundaryBorder: boolean;
59
+ googleMapStaticApiKey: string;
60
+ onH5FirstSelectObstaclePoint: any;
41
61
  }>;
42
62
  export declare const CommonContextProvider: import("react").Provider<{
43
63
  sn: string;
44
64
  editMap: boolean;
45
- mowerIconConfig: {};
65
+ mowerIconConfig: {
66
+ mapImgUrl: string;
67
+ mapDisabledUrl: string;
68
+ mapNoPositionUrl: string;
69
+ };
46
70
  platform: PlatformType;
47
71
  svgViewBox: any;
48
72
  unitType: UnitsType;
73
+ mapConfig: {};
74
+ mapJson: any;
75
+ drag: {
76
+ x: number;
77
+ y: number;
78
+ rotate: number;
79
+ rotation: number;
80
+ };
49
81
  mapRef: any;
82
+ bounds: any;
50
83
  globalHeight: number;
51
84
  heightOptions: any[];
52
85
  overlayScale: number;
53
86
  showStraddleBoundaryBorder: boolean;
87
+ googleMapStaticApiKey: string;
88
+ onH5FirstSelectObstaclePoint: any;
54
89
  }>;
55
90
  export declare const useCommonContext: () => CommonContextType;
56
91
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/context/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAE3D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,UAAU,iBAAiB;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,EAAE,eAAe,CAAC;IACjC,QAAQ,EAAE,YAAY,CAAC;IACvB,UAAU,EAAE;QAAE,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;IACpE,QAAQ,EAAE,SAAS,CAAC;IACpB,aAAa,EAAE,MAAM,EAAE,CAAC;IACxB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC/B,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,CAAC,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IACpD,MAAM,EAAE,GAAG,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,0BAA0B,CAAC,EAAE,OAAO,CAAC;IACrC,UAAU,CAAC,EAAE,GAAG,EAAE,CAAC;CACpB;AAED,eAAO,MAAM,aAAa;;;;;;;;;;;;EAYxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;EAAyB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,yBAAqD,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/context/common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;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