@anov/3d-ability 0.0.4-alpha4 → 0.0.4-alpha5

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.
@@ -1,2 +1,2 @@
1
- import type { IPOIOption } from './index';
1
+ import type { IPOIOption } from './type';
2
2
  export declare const getDom: (option: IPOIOption) => HTMLDivElement;
@@ -33,4 +33,4 @@ export var getDom = function getDom(option) {
33
33
  container.appendChild(poiDom);
34
34
  return container;
35
35
  };
36
- //# sourceMappingURL=poiDom.js.map
36
+ //# sourceMappingURL=dom.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["IMG_BASE","IMG_LINE","style","common","color","boxSizing","padding","display","justifyContent","backgroundSize","backgroundRepeat","base","width","height","alignItems","backgroundImage","line","getDom","option","container","document","createElement","poiDom","type","forEach","item","Object","keys","key","innerText","title","appendChild"],"sources":["../../src/poi/dom.ts"],"sourcesContent":["import { IMG_BASE, IMG_LINE } from './assets'\nimport type { IPOIOption } from './type'\n\nconst style = {\n common: {\n color: '#fff',\n boxSizing: 'border-box',\n padding: '10px',\n display: 'flex',\n justifyContent: 'center',\n backgroundSize: '100% 100%',\n backgroundRepeat: 'no-repeat',\n },\n base: {\n width: '200px',\n height: '100px',\n alignItems: 'center',\n backgroundImage: `url(\"${IMG_BASE}\")`,\n },\n line: {\n width: '200px',\n height: '200px',\n backgroundImage: `url(\"${IMG_LINE}\")`,\n },\n}\n\nexport const getDom = (option: IPOIOption) => {\n const container = document.createElement('div')\n const poiDom = document.createElement('div');\n\n [style.common, style[option.type], option.style || {}].forEach((item) => {\n Object.keys(item).forEach((key) => {\n poiDom.style[key] = item[key]\n })\n })\n poiDom.innerText = option.title\n container.appendChild(poiDom)\n return container\n}"],"mappings":"AAAA,SAASA,QAAQ,EAAEC,QAAQ;AAG3B,IAAMC,KAAK,GAAG;EACZC,MAAM,EAAE;IACNC,KAAK,EAAE,MAAM;IACbC,SAAS,EAAE,YAAY;IACvBC,OAAO,EAAE,MAAM;IACfC,OAAO,EAAE,MAAM;IACfC,cAAc,EAAE,QAAQ;IACxBC,cAAc,EAAE,WAAW;IAC3BC,gBAAgB,EAAE;EACpB,CAAC;EACDC,IAAI,EAAE;IACJC,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE,OAAO;IACfC,UAAU,EAAE,QAAQ;IACpBC,eAAe,kBAAUf,QAAQ;EACnC,CAAC;EACDgB,IAAI,EAAE;IACJJ,KAAK,EAAE,OAAO;IACdC,MAAM,EAAE,OAAO;IACfE,eAAe,kBAAUd,QAAQ;EACnC;AACF,CAAC;AAED,OAAO,IAAMgB,MAAM,GAAG,SAATA,MAAM,CAAIC,MAAkB,EAAK;EAC5C,IAAMC,SAAS,GAAGC,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAC/C,IAAMC,MAAM,GAAGF,QAAQ,CAACC,aAAa,CAAC,KAAK,CAAC;EAE5C,CAACnB,KAAK,CAACC,MAAM,EAAED,KAAK,CAACgB,MAAM,CAACK,IAAI,CAAC,EAAEL,MAAM,CAAChB,KAAK,IAAI,CAAC,CAAC,CAAC,CAACsB,OAAO,CAAC,UAACC,IAAI,EAAK;IACvEC,MAAM,CAACC,IAAI,CAACF,IAAI,CAAC,CAACD,OAAO,CAAC,UAACI,GAAG,EAAK;MACjCN,MAAM,CAACpB,KAAK,CAAC0B,GAAG,CAAC,GAAGH,IAAI,CAACG,GAAG,CAAC;IAC/B,CAAC,CAAC;EACJ,CAAC,CAAC;EACFN,MAAM,CAACO,SAAS,GAAGX,MAAM,CAACY,KAAK;EAC/BX,SAAS,CAACY,WAAW,CAACT,MAAM,CAAC;EAC7B,OAAOH,SAAS;AAClB,CAAC"}
@@ -1,18 +1,4 @@
1
- export declare enum EPOIType {
2
- base = 0,
3
- line = 1
4
- }
5
- export interface IPOIOption {
6
- id?: number | string;
7
- name?: string;
8
- position?: Array<number>;
9
- location?: Array<number>;
10
- visible?: boolean;
11
- type?: EPOIType;
12
- title: string;
13
- autoSize?: boolean;
14
- style?: object;
15
- }
1
+ import type { IPOIOption } from './type';
16
2
  declare class Poi {
17
3
  private cssObjects;
18
4
  constructor();
@@ -22,6 +8,11 @@ declare class Poi {
22
8
  visible: boolean | undefined;
23
9
  position: number[] | undefined;
24
10
  };
11
+ /**
12
+ * 是否锁定镜头,标牌一直面向镜头
13
+ */
14
+ private updateAxis;
15
+ private updateScale;
25
16
  delete(option: IPOIOption): void;
26
17
  update(option: IPOIOption): void;
27
18
  }
package/dist/poi/index.js CHANGED
@@ -5,14 +5,12 @@ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _d
5
5
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
6
  function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
7
7
  function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
8
- import { create3DLabel, use } from '@anov/3d-core';
8
+ import { Vector3, create3DLabel, use } from '@anov/3d-core';
9
9
  import { getLastValue } from "../utils";
10
- import { getDom } from "./poiDom";
11
- export var EPOIType;
12
- (function (EPOIType) {
13
- EPOIType[EPOIType["base"] = 0] = "base";
14
- EPOIType[EPOIType["line"] = 1] = "line";
15
- })(EPOIType || (EPOIType = {}));
10
+ import { getDom } from "./dom";
11
+ // 距离限制范围的值,用于计算缩放比例
12
+ var minDistance = 0.1;
13
+ var maxDistance = 1000000;
16
14
  var Poi = /*#__PURE__*/function () {
17
15
  function Poi() {
18
16
  _classCallCheck(this, Poi);
@@ -22,6 +20,7 @@ var Poi = /*#__PURE__*/function () {
22
20
  _createClass(Poi, [{
23
21
  key: "create",
24
22
  value: function create(option) {
23
+ var _this = this;
25
24
  var visible = option.visible,
26
25
  position = option.position,
27
26
  name = option.name;
@@ -29,10 +28,11 @@ var Poi = /*#__PURE__*/function () {
29
28
  // 对象名称
30
29
  poiLabel.name = getLastValue(name, 'poiLabel');
31
30
  poiLabel.receiveShadow = true;
31
+ poiLabel.option = option;
32
32
  // 是否可见
33
33
  poiLabel.visible = getLastValue(visible, true);
34
34
  // 设置poi局部位置
35
- position && poiLabel.position.set(position[0], position[1], position[2]);
35
+ position && poiLabel.position.copy(new Vector3().fromArray(position));
36
36
  // poiLabel.position.set(0, (200 * 0.023) / 2 + 3, 0);
37
37
 
38
38
  var devicePixelRatio = window.devicePixelRatio || 1;
@@ -43,7 +43,10 @@ var Poi = /*#__PURE__*/function () {
43
43
  // 添加到场景
44
44
  scene === null || scene === void 0 ? void 0 : scene.add(poiLabel);
45
45
  this.cssObjects.push(poiLabel);
46
- use.useframe(function () {});
46
+ use.useframe(function () {
47
+ option.lockAxis && _this.updateAxis(poiLabel);
48
+ if ('autoSize' in option && !option.autoSize) _this.updateScale(poiLabel);
49
+ });
47
50
  return {
48
51
  id: poiLabel.id,
49
52
  name: name,
@@ -52,15 +55,51 @@ var Poi = /*#__PURE__*/function () {
52
55
  };
53
56
  }
54
57
 
58
+ /**
59
+ * 是否锁定镜头,标牌一直面向镜头
60
+ */
61
+ }, {
62
+ key: "updateAxis",
63
+ value: function updateAxis(object) {
64
+ var _use$useScene2 = use.useScene(),
65
+ camera = _use$useScene2.camera;
66
+ // 获取原有的旋转角度
67
+ var oriEuler = object.rotation;
68
+ // 根据锁定的轴进行旋转
69
+ camera && object.rotation.copy(camera.rotation);
70
+ }
71
+
72
+ /// <summary>
73
+ /// 按照距离缩放,距离越远,缩放越大
74
+ /// </summary>
75
+ }, {
76
+ key: "updateScale",
77
+ value: function updateScale(object) {
78
+ var _use$useScene3 = use.useScene(),
79
+ camera = _use$useScene3.camera;
80
+ // 获取相机和物体的世界坐标位置
81
+ var cameraPosition = camera === null || camera === void 0 ? void 0 : camera.position;
82
+ var objectPosition = object.position;
83
+
84
+ // 计算相机和物体之间的距离
85
+ var distance = (cameraPosition === null || cameraPosition === void 0 ? void 0 : cameraPosition.distanceTo(objectPosition)) || 0.1;
86
+
87
+ // 使用 Math.min() 和 Math.max() 方法限制 resultDistance 的范围
88
+ var clampedDistance = Math.max(minDistance, Math.min(maxDistance, distance));
89
+
90
+ // 按照缩放系数和距离进行缩放,缩放系数应该约定好一个固定值
91
+ object.scale.copy(new Vector3(1, 1, 1).multiplyScalar(clampedDistance * 0.0012));
92
+ }
93
+
55
94
  // 删除POI点信息
56
95
  }, {
57
96
  key: "delete",
58
97
  value: function _delete(option) {
59
- var _use$useScene2 = use.useScene(),
60
- scene = _use$useScene2.scene;
98
+ var _use$useScene4 = use.useScene(),
99
+ scene = _use$useScene4.scene;
61
100
  for (var i = 0; i < this.cssObjects.length; i++) {
62
101
  if (this.cssObjects[i].id === option.id) {
63
- scene.remove(this.cssObjects[i]);
102
+ scene === null || scene === void 0 ? void 0 : scene.remove(this.cssObjects[i]);
64
103
  break;
65
104
  }
66
105
  }
@@ -1 +1 @@
1
- {"version":3,"names":["create3DLabel","use","getLastValue","getDom","EPOIType","Poi","option","visible","position","name","poiLabel","receiveShadow","set","devicePixelRatio","window","scale","useScene","scene","add","cssObjects","push","useframe","id","i","length","remove"],"sources":["../../src/poi/index.ts"],"sourcesContent":["import type {\n CSS2DObject,\n CSS3DObject,\n} from '@anov/3d-core'\nimport {\n create3DLabel,\n createLabel,\n use,\n} from '@anov/3d-core'\nimport { getLastValue } from '../utils'\nimport { getDom } from './poiDom'\n\nexport enum EPOIType {\n base,\n line,\n}\n\nexport interface IPOIOption {\n id?: number | string // 唯一ID\n name?: string // 别名\n position?: Array<number> // 聚焦目标位置[x,y,z] 单位cm positon和location字段必须有一个非空\n location?: Array<number> // 聚焦目标位置[经度,纬度,高度] 单位m positon和location字段必须有一个非空\n visible?: boolean // POI创建后是否可见\n type?: EPOIType\n title: string\n autoSize?: boolean // css2D渲染或3D渲染\n style?: object // POI样式字符串\n}\n\ntype CSSObject = CSS2DObject | CSS3DObject\n\nclass Poi {\n private cssObjects: CSSObject[] = []\n\n constructor() { }\n // 添加POI点信息\n public create(option: IPOIOption) {\n const { visible, position, name } = option\n\n const poiLabel = create3DLabel(getDom(option))\n // 对象名称\n poiLabel.name = getLastValue(name, 'poiLabel')\n poiLabel.receiveShadow = true\n // 是否可见\n poiLabel.visible = getLastValue(visible, true)\n // 设置poi局部位置\n position && poiLabel.position.set(position[0], position[1], position[2])\n // poiLabel.position.set(0, (200 * 0.023) / 2 + 3, 0);\n\n const devicePixelRatio = window.devicePixelRatio || 1\n // 调整场景中对象的缩放比例\n poiLabel.scale.set(0.023, 0.023, 0.023)\n\n const { scene } = use.useScene()\n // 添加到场景\n scene?.add(poiLabel)\n this.cssObjects.push(poiLabel)\n\n use.useframe(() => {\n })\n\n return {\n id: poiLabel.id,\n name,\n visible,\n position,\n }\n }\n\n // 删除POI点信息\n public delete(option: IPOIOption) {\n const { scene } = use.useScene()\n for (let i = 0; i < this.cssObjects.length; i++) {\n if (this.cssObjects[i].id === option.id) {\n scene.remove(this.cssObjects[i])\n break\n }\n }\n }\n\n public update(option: IPOIOption) { }\n}\n\nexport default Poi\n"],"mappings":";;;;;;;AAIA,SACEA,aAAa,EAEbC,GAAG,QACE,eAAe;AACtB,SAASC,YAAY;AACrB,SAASC,MAAM;AAEf,WAAYC,QAAQ;AAGnB,WAHWA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;AAAA,GAARA,QAAQ,KAARA,QAAQ;AAAA,IAmBdC,GAAG;EAGP,eAAc;IAAA;IAAA,oCAFoB,EAAE;EAEpB;EAChB;EAAA;IAAA;IAAA,OACA,gBAAcC,MAAkB,EAAE;MAChC,IAAQC,OAAO,GAAqBD,MAAM,CAAlCC,OAAO;QAAEC,QAAQ,GAAWF,MAAM,CAAzBE,QAAQ;QAAEC,IAAI,GA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AC/C,IAAI,IAAI,CAACJ,UAAU,CAACI,CAAC,CAAC,CAACD,EAAE,KAAKhB,MAAM,CAACgB,EAAE,EAAE;UACvCL,KAAK,CAACQ,MAAM,CAAC,IAAI,CAACN,UAAU,CAACI,CAAC,CAAC,CAAC;UAChC;QACF;MACF;IACF;EAAC;IAAA;IAAA,OAED,gBAAcjB,MAAkB,EAAE,CAAE;EAAC;EAAA;AAAA;AAGvC,eAAeD,GAAG"}
1
+ {"version":3,"names":["Vector3","create3DLabel","use","getLastValue","getDom","minDistance","maxDistance","Poi","option","visible","position","name","poiLabel","receiveShadow","copy","fromArray","devicePixelRatio","window","scale","set","useScene","scene","add","cssObjects","push","useframe","lockAxis","updateAxis","autoSize","updateScale","id","object","camera","oriEuler","rotation","cameraPosition","objectPosition","distance","distanceTo","clampedDistance","Math","max","min","multiplyScalar","i","length","remove"],"sources":["../../src/poi/index.ts"],"sourcesContent":["import {\n Vector3,\n create3DLabel,\n use,\n} from '@anov/3d-core'\nimport { getLastValue } from '../utils'\nimport { getDom } from './dom'\nimport type { CustomCssObjec, IPOIOption } from './type'\n\n// 距离限制范围的值,用于计算缩放比例\nconst minDistance = 0.1\nconst maxDistance = 1000000\n\nclass Poi {\n private cssObjects: CustomCssObjec[] = []\n\n constructor() { }\n // 添加POI点信息\n public create(option: IPOIOption) {\n const { visible, position, name } = option\n\n const poiLabel = create3DLabel(getDom(option)) as CustomCssObjec\n // 对象名称\n poiLabel.name = getLastValue(name, 'poiLabel')\n poiLabel.receiveShadow = true\n poiLabel.option = option\n // 是否可见\n poiLabel.visible = getLastValue(visible, true)\n // 设置poi局部位置\n position && poiLabel.position.copy(new Vector3().fromArray(position))\n // poiLabel.position.set(0, (200 * 0.023) / 2 + 3, 0);\n\n const devicePixelRatio = window.devicePixelRatio || 1\n // 调整场景中对象的缩放比例\n poiLabel.scale.set(0.023, 0.023, 0.023)\n const { scene } = use.useScene()\n // 添加到场景\n scene?.add(poiLabel)\n this.cssObjects.push(poiLabel)\n\n use.useframe(() => {\n option.lockAxis && this.updateAxis(poiLabel)\n if ('autoSize' in option && !option.autoSize)\n this.updateScale(poiLabel)\n })\n\n return {\n id: poiLabel.id,\n name,\n visible,\n position,\n }\n }\n\n /**\n * 是否锁定镜头,标牌一直面向镜头\n */\n private updateAxis(object: CustomCssObjec) {\n const { camera } = use.useScene()\n // 获取原有的旋转角度\n const oriEuler = object.rotation\n // 根据锁定的轴进行旋转\n camera && object.rotation.copy(camera.rotation)\n }\n\n /// <summary>\n /// 按照距离缩放,距离越远,缩放越大\n /// </summary>\n private updateScale(object: CustomCssObjec) {\n const { camera } = use.useScene()\n // 获取相机和物体的世界坐标位置\n const cameraPosition = camera?.position\n const objectPosition = object.position\n\n // 计算相机和物体之间的距离\n const distance = cameraPosition?.distanceTo(objectPosition) || 0.1\n\n // 使用 Math.min() 和 Math.max() 方法限制 resultDistance 的范围\n const clampedDistance = Math.max(minDistance, Math.min(maxDistance, distance))\n\n // 按照缩放系数和距离进行缩放,缩放系数应该约定好一个固定值\n object.scale.copy(new Vector3(1, 1, 1).multiplyScalar(clampedDistance * 0.0012))\n }\n\n // 删除POI点信息\n public delete(option: IPOIOption) {\n const { scene } = use.useScene()\n for (let i = 0; i < this.cssObjects.length; i++) {\n if (this.cssObjects[i].id === option.id) {\n scene?.remove(this.cssObjects[i])\n break\n }\n }\n }\n\n public update(option: IPOIOption) { }\n}\n\nexport default Poi\n"],"mappings":";;;;;;;AAAA,SACEA,OAAO,EACPC,aAAa,EACbC,GAAG,QACE,eAAe;AACtB,SAASC,YAAY;AACrB,SAASC,MAAM;AAGf;AACA,IAAMC,WAAW,GAAG,GAAG;AACvB,IAAMC,WAAW,GAAG,OAAO;AAAA,IAErBC,GAAG;EAGP,eAAc;IAAA;IAAA,oCAFyB,EAAE;EAEzB;EAChB;EAAA;IAAA;IAAA,OACA,gBAAcC,MAAkB,EAAE;MAAA;MAChC,IAAQC,OAAO,GAAqBD,MAAM,CAAlCC,OAAO;QAAEC,QAAQ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qB,CAAC,CAAC,CAACd,EAAE,KAAKtB,MAAM,CAACsB,EAAE,EAAE;UACvCT,KAAK,aAALA,KAAK,uBAALA,KAAK,CAAEyB,MAAM,CAAC,IAAI,CAACvB,UAAU,CAACqB,CAAC,CAAC,CAAC;UACjC;QACF;MACF;IACF;EAAC;IAAA;IAAA,OAED,gBAAcpC,MAAkB,EAAE,CAAE;EAAC;EAAA;AAAA;AAGvC,eAAeD,GAAG"}
@@ -0,0 +1,20 @@
1
+ import type { CSS3DObject } from '@anov/3d-core';
2
+ export declare enum EPOIType {
3
+ base = 0,
4
+ line = 1
5
+ }
6
+ export interface CustomCssObjec extends CSS3DObject {
7
+ option: IPOIOption;
8
+ }
9
+ export interface IPOIOption {
10
+ id?: number | string;
11
+ name?: string;
12
+ title: string;
13
+ type?: EPOIType;
14
+ position?: Array<number>;
15
+ location?: Array<number>;
16
+ visible?: boolean;
17
+ autoSize?: boolean;
18
+ lockAxis?: Boolean;
19
+ style?: object;
20
+ }
@@ -0,0 +1,6 @@
1
+ export var EPOIType;
2
+ (function (EPOIType) {
3
+ EPOIType[EPOIType["base"] = 0] = "base";
4
+ EPOIType[EPOIType["line"] = 1] = "line";
5
+ })(EPOIType || (EPOIType = {}));
6
+ //# sourceMappingURL=type.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["EPOIType"],"sources":["../../src/poi/type.ts"],"sourcesContent":["import type {\n CSS3DObject,\n} from '@anov/3d-core'\n\nexport enum EPOIType {\n base,\n line,\n}\n\nexport interface CustomCssObjec extends CSS3DObject {\n option: IPOIOption\n}\n\nexport interface IPOIOption {\n id?: number | string // 唯一ID\n name?: string // 别名\n title: string\n type?: EPOIType\n position?: Array<number> // 聚焦目标位置[x,y,z] 单位cm positon和location字段必须有一个非空\n location?: Array<number> // 聚焦目标位置[经度,纬度,高度] 单位m positon和location字段必须有一个非空\n visible?: boolean\n autoSize?: boolean // 是否支持缩放\n lockAxis?: Boolean // 是否锁定镜头(标牌一直面向镜头)\n style?: object // POI样式字符串\n}\n"],"mappings":"AAIA,WAAYA,QAAQ;AAGnB,WAHWA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;EAARA,QAAQ,CAARA,QAAQ;AAAA,GAARA,QAAQ,KAARA,QAAQ"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anov/3d-ability",
3
- "version": "0.0.4-alpha4",
3
+ "version": "0.0.4-alpha5",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  "@types/suncalc": "^1.9.2",
20
20
  "postprocessing": "^6.33.3",
21
21
  "suncalc": "^1.9.0",
22
- "@anov/3d-core": "^0.0.4-alpha14"
22
+ "@anov/3d-core": "^0.0.4-alpha16"
23
23
  },
24
24
  "scripts": {
25
25
  "build": "father build",
@@ -1 +0,0 @@
1
- {"version":3,"names":["IMG_BASE","IMG_LINE","style","common","color","boxSizing","padding","display","justifyContent","backgroundSize","backgroundRepeat","base","width","height","alignItems","backgroundImage","line","getDom","option","container","document","createElement","poiDom","type","forEach","item","Object","keys","key","innerText","title","appendChild"],"sources":["../../src/poi/poiDom.ts"],"sourcesContent":["import { IMG_BASE, IMG_LINE } from './assets'\nimport type { IPOIOption } from './index'\nimport { EPOIType } from './index'\n\nconst style = {\n common: {\n color: '#fff',\n boxSizing: 'border-box',\n padding: '10px',\n display: 'flex',\n justifyContent: 'center',\n backgroundSize: '100% 100%',\n backgroundRepeat: 'no-repeat',\n },\n base: {\n width: '200px',\n height: '100px',\n alignItems: 'center',\n backgroundImage: `url(\"${IMG_BASE}\")`,\n },\n line: {\n width: '200px',\n height: '200px',\n backgroundImage: `url(\"${IMG_LINE}\")`,\n },\n}\n\nexport const getDom = (option: IPOIOption) => {\n const container = document.createElement('div')\n const poiDom = document.createElement('div');\n\n [style.common, style[option.type], option.style || {}].forEach((item) => {\n Object.keys(item).forEach((key) => {\n poiDom.style[key] = item[key]\n })\n })\n poiDom.innerText = option.title\n container.appendCh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