fanLocal.three.ts 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606
  1. import * as THREE from 'three';
  2. import { CSS3DObject } from 'three/examples/jsm/renderers/CSS3DRenderer.js';
  3. import { animateCamera, getTextCanvas, renderVideo, updateAxisCenter } from '/@/utils/threejs/util';
  4. import UseThree from '../../../../utils/threejs/useThree';
  5. import fcFan from './fcfanLocal.three';
  6. import fmFan from './fmfanLocal.three';
  7. import Smoke from '/@/views/vent/comment/threejs/Smoke';
  8. import gsap from 'gsap';
  9. import useEvent from '../../../../utils/threejs/useEvent';
  10. // import * as dat from 'dat.gui';
  11. // const gui = new dat.GUI();
  12. // gui.domElement.style = 'position:absolute;top:100px;left:10px;z-index:99999999999999';
  13. const modelName = 'jbfj-hd';
  14. // 模型对象、 文字对象
  15. let model: UseThree | undefined,
  16. group: THREE.Object3D | undefined,
  17. fcFanObj: fcFan | undefined,
  18. fmFanObj: fmFan | undefined,
  19. player1,
  20. fanType,
  21. topSmoke: Smoke | undefined,
  22. downSmoke: Smoke | undefined,
  23. topLife: number | undefined,
  24. downLife: number | undefined,
  25. playerStartClickTime1 = new Date().getTime();
  26. const { mouseDownFn, mousemoveFn, mouseUpFn } = useEvent();
  27. // 打灯光
  28. const addLight = () => {
  29. const directionalLight = new THREE.DirectionalLight(0xffffff, 1.2);
  30. directionalLight.position.set(-564, 602, -261);
  31. group?.add(directionalLight);
  32. // directionalLight.target = group;
  33. // const spotLight = new THREE.SpotLight();
  34. // spotLight.angle = Math.PI / 16;
  35. // spotLight.penumbra = 0;
  36. // spotLight.castShadow = true;
  37. // spotLight.position.set(0, 463, 687);
  38. // scene.add(spotLight);
  39. // spotLight.shadow.camera.near = 0.5; // default
  40. // spotLight.shadow.camera.far = 1000; // default
  41. // spotLight.shadow.focus = 1;
  42. // spotLight.shadow.bias = -0.000002;
  43. // spotLight.target = group;
  44. // const pointLight6 = new THREE.PointLight(0xffffff, 1, 500);
  45. // pointLight6.position.set(-131, 64, -1);
  46. // pointLight6.shadow.bias = 0.05;
  47. // group?.add(pointLight6);
  48. // gui.add(directionalLight.position, 'x', -1000, 1000);
  49. // gui.add(directionalLight.position, 'y', -1000, 1000);
  50. // gui.add(directionalLight.position, 'z', -1000, 1000);
  51. // gui.add(pointLight6.position, 'x', -500, 500);
  52. // gui.add(pointLight6.position, 'y', -500, 500);
  53. // gui.add(pointLight6.position, 'z', -500, 500);
  54. // gui.add(pointLight6, 'distance', 0, 500);
  55. };
  56. // 重置摄像头
  57. const resetCamera = () => {
  58. model.camera.position.set(0, -1000, 100);
  59. model.camera.far = 1000;
  60. model.orbitControls?.update();
  61. model.camera.updateProjectionMatrix();
  62. };
  63. // 设置模型位置
  64. const setModalPosition = () => {
  65. if (!group) return;
  66. group.position.set(0, 10, -50);
  67. group.rotation.y = Math.PI / 2;
  68. };
  69. const setControls = () => {
  70. model.orbitControls.panSpeed = 0.5;
  71. model.orbitControls.rotateSpeed = 0.5;
  72. model.orbitControls.maxPolarAngle = Math.PI / 2.4;
  73. model.orbitControls.minPolarAngle = Math.PI / 3;
  74. };
  75. // 切换局部通风机类型
  76. export const setModelType = (type) => {
  77. fanType = type;
  78. return new Promise((resolve) => {
  79. // 显示双道风窗
  80. let childGroup;
  81. if (fanType === 'fm' && fcFanObj && fcFanObj.group) {
  82. if (group.getObjectByName('jbfj-fc')) {
  83. group.remove(fcFanObj.group);
  84. }
  85. childGroup = fmFanObj.group;
  86. (group?.getObjectByName('text5')).visible = false;
  87. (group?.getObjectByName('text4')).visible = true;
  88. } else if (fanType === 'fc' && fmFanObj && fmFanObj.group) {
  89. // 显示单道风窗
  90. if (group.getObjectByName('jbfj-fm')) {
  91. group.remove(fmFanObj.group);
  92. }
  93. childGroup = fcFanObj.group;
  94. (group?.getObjectByName('text5')).visible = true;
  95. (group?.getObjectByName('text4')).visible = false;
  96. }
  97. setTimeout(async () => {
  98. group?.add(childGroup);
  99. const oldCameraPosition = { x: 615, y: 275, z: 744 };
  100. await animateCamera(oldCameraPosition, { x: 0, y: 0, z: 0 }, { x: 0.08, y: 21.73, z: 78.45 }, { x: 0.13, y: -0.82, z: 0.236 }, model, 0.8);
  101. resolve(null);
  102. }, 300);
  103. });
  104. };
  105. /* 添加监控数据 */
  106. export const addText = (selectData) => {
  107. if (!group) {
  108. return;
  109. }
  110. const textArr = [
  111. {
  112. text: `煤矿巷道远程局部风机系统`,
  113. font: 'normal 30px Arial',
  114. color: '#009900',
  115. strokeStyle: '#002200',
  116. x: 50,
  117. y: 110,
  118. },
  119. {
  120. text: `进风量(m³/min):`,
  121. font: 'normal 30px Arial',
  122. color: '#009900',
  123. strokeStyle: '#002200',
  124. x: 0,
  125. y: 165,
  126. },
  127. {
  128. text: `${selectData.windQuantity1}`,
  129. font: 'normal 30px Arial',
  130. color: '#009900',
  131. strokeStyle: '#002200',
  132. x: 290,
  133. y: 165,
  134. },
  135. {
  136. text: `供风量(m³/min): `,
  137. font: 'normal 30px Arial',
  138. color: '#009900',
  139. strokeStyle: '#002200',
  140. x: 0,
  141. y: 220,
  142. },
  143. {
  144. text: ` ${selectData.windQuantity2}`,
  145. font: 'normal 30px Arial',
  146. color: '#009900',
  147. strokeStyle: '#002200',
  148. x: 280,
  149. y: 220,
  150. },
  151. {
  152. text: `故障诊断:`,
  153. font: 'normal 30px Arial',
  154. color: '#009900',
  155. strokeStyle: '#002200',
  156. x: 0,
  157. y: 275,
  158. },
  159. {
  160. text: `${selectData.fault}`,
  161. font: 'normal 30px Arial',
  162. color: '#009900',
  163. strokeStyle: '#002200',
  164. x: 280,
  165. y: 275,
  166. },
  167. {
  168. text: `煤炭科学技术研究院有限公司研制`,
  169. font: 'normal 28px Arial',
  170. color: '#009900',
  171. strokeStyle: '#002200',
  172. x: 20,
  173. y: 325,
  174. },
  175. ];
  176. getTextCanvas(526, 346, textArr, '').then((canvas: HTMLCanvasElement) => {
  177. const textMap = new THREE.CanvasTexture(canvas); // 关键一步
  178. const textMaterial = new THREE.MeshBasicMaterial({
  179. // 关于材质并未讲解 实操即可熟悉 这里是漫反射类似纸张的材质,对应的就有高光类似金属的材质.
  180. map: textMap, // 设置纹理贴图
  181. transparent: true,
  182. side: THREE.FrontSide, // 这里是双面渲染的意思
  183. });
  184. textMaterial.blending = THREE.CustomBlending;
  185. const monitorPlane = group.getObjectByName('monitorText');
  186. if (monitorPlane) {
  187. monitorPlane.material = textMaterial;
  188. } else {
  189. const planeGeometry = new THREE.PlaneGeometry(526, 346); // 平面3维几何体PlaneGeometry
  190. const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
  191. planeMesh.name = 'monitorText';
  192. planeMesh.scale.set(0.0135, 0.0135, 0.0135);
  193. planeMesh.rotation.y = -Math.PI / 2;
  194. planeMesh.position.set(-84.79, 0.82, 17.01);
  195. group.add(planeMesh);
  196. }
  197. });
  198. };
  199. // // css3D文字
  200. export const addCssText = () => {
  201. if (!group) return;
  202. if (!group.getObjectByName('text1')) {
  203. const element = document.getElementById('inputBox') as HTMLElement;
  204. const fanLocalCSS3D = new CSS3DObject(element);
  205. fanLocalCSS3D.name = 'text1';
  206. fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
  207. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  208. fanLocalCSS3D.position.set(-85.68, 5.97, -17.74);
  209. group.add(fanLocalCSS3D);
  210. }
  211. if (!group.getObjectByName('text2')) {
  212. const element = document.getElementById('outBox') as HTMLElement;
  213. const fanLocalCSS3D = new CSS3DObject(element);
  214. fanLocalCSS3D.name = 'text2';
  215. fanLocalCSS3D.scale.set(0.1, 0.1, 0.1);
  216. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  217. fanLocalCSS3D.position.set(74.63, 13.54, 3.84);
  218. group.add(fanLocalCSS3D);
  219. }
  220. if (!group.getObjectByName('text3')) {
  221. const element = document.getElementById('returnBox') as HTMLElement;
  222. const fanLocalCSS3D = new CSS3DObject(element);
  223. fanLocalCSS3D.name = 'text3';
  224. fanLocalCSS3D.scale.set(0.1, 0.1, 0.1);
  225. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  226. fanLocalCSS3D.position.set(35.28, 10.05, -37.23);
  227. group.add(fanLocalCSS3D);
  228. }
  229. if (!group.getObjectByName('text4')) {
  230. const element = document.getElementById('gateBox') as HTMLElement;
  231. if (element) {
  232. // element.innerHTML = '';
  233. const fanLocalCSS3D = new CSS3DObject(element);
  234. fanLocalCSS3D.name = 'text4';
  235. fanLocalCSS3D.scale.set(0.04, 0.04, 0.04);
  236. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  237. fanLocalCSS3D.position.set(-73.13, 8.44, -23.52);
  238. group.add(fanLocalCSS3D);
  239. }
  240. }
  241. if (!group.getObjectByName('text5')) {
  242. const element = document.getElementById('windownBox') as HTMLElement;
  243. if (element) {
  244. // element.innerHTML = '';
  245. const fanLocalCSS3D = new CSS3DObject(element);
  246. fanLocalCSS3D.name = 'text5';
  247. fanLocalCSS3D.scale.set(0.07, 0.07, 0.07);
  248. fanLocalCSS3D.rotation.y = -Math.PI / 2;
  249. fanLocalCSS3D.position.set(-28.44, 9.78, -40.42);
  250. group.add(fanLocalCSS3D);
  251. }
  252. }
  253. };
  254. // export const playSmoke = (controlType, deviceType, frequency, state) => {
  255. // if (frequency) {
  256. // setSmokeFrequency(deviceType, frequency);
  257. // }
  258. // if (controlType === 'startSmoke') {
  259. // runFly(deviceType, state);
  260. // }
  261. // };
  262. export const playSmoke = (selectData) => {
  263. console.log('selectData[Fan1fHz]------------》',selectData['Fan1fHz'], Number(selectData['Fan1fHz']));
  264. if (selectData['Fan1StartStatus'] == 1) {
  265. // 主风机打开
  266. // setSmokeFrequency('top', Number(selectData['Fan1fHz']) || 40);
  267. setSmokeFrequency('top', 40);
  268. runFly('top', 'open');
  269. } else {
  270. // 备风机关闭
  271. runFly('top', 'close');
  272. }
  273. if (selectData['Fan2StartStatus'] == 1) {
  274. // 备风机打开
  275. // setSmokeFrequency('down', Number(selectData['Fan2fHz']) || 40);
  276. setSmokeFrequency('down', 40);
  277. runFly('down', 'open');
  278. } else {
  279. // 备风机关闭
  280. runFly('down', 'close');
  281. }
  282. // if (frequency) {
  283. // setSmokeFrequency(deviceType, frequency);
  284. // }
  285. // if (controlType === 'startSmoke') {
  286. // runFly(deviceType, state);
  287. // }
  288. };
  289. const initFly = async () => {
  290. const topCurve = [
  291. {
  292. path0: new THREE.Vector3(-89.84, 2.359, 4.91),
  293. path1: new THREE.Vector3(-85.678, 2.359, 3.61),
  294. isSpread: true,
  295. spreadDirection: -1, //
  296. },
  297. {
  298. path0: new THREE.Vector3(-85.678, 2.352, 3.66),
  299. path1: new THREE.Vector3(-85.636, 2.353, -3.829),
  300. isSpread: false,
  301. spreadDirection: 0,
  302. },
  303. {
  304. path0: new THREE.Vector3(-85.636, 2.353, -3.829),
  305. path1: new THREE.Vector3(-85.636, 1.026, -5.881),
  306. isSpread: false,
  307. spreadDirection: 0,
  308. },
  309. {
  310. path0: new THREE.Vector3(-85.636, 1.026, -5.881),
  311. path1: new THREE.Vector3(-85.618, 0.887, -12.862),
  312. isSpread: false,
  313. spreadDirection: 0,
  314. },
  315. {
  316. path0: new THREE.Vector3(-85.618, 0.827, -12.962),
  317. path1: new THREE.Vector3(80.404, 0.827, -12.962),
  318. isSpread: false,
  319. spreadDirection: 0,
  320. },
  321. {
  322. path0: new THREE.Vector3(80.404, 0.827, -12.962),
  323. path1: new THREE.Vector3(93.164, 0.85, -12.962),
  324. isSpread: true,
  325. spreadDirection: 1, // 1是由小变大,-1是由大变小
  326. },
  327. ];
  328. const downCurve = [
  329. {
  330. path0: new THREE.Vector3(-94.84, -0.388, 3.61),
  331. path1: new THREE.Vector3(-85.678, -0.393, 3.61),
  332. isSpread: true,
  333. spreadDirection: -1, //
  334. },
  335. {
  336. path0: new THREE.Vector3(-85.678, -0.393, 3.275),
  337. path1: new THREE.Vector3(-85.636, -0.392, -3.829),
  338. isSpread: false,
  339. spreadDirection: 0,
  340. },
  341. {
  342. path0: new THREE.Vector3(-85.636, -0.392, -3.829),
  343. path1: new THREE.Vector3(-85.636, 0.926, -5.881),
  344. isSpread: false,
  345. spreadDirection: 0,
  346. },
  347. {
  348. path0: new THREE.Vector3(-85.636, 1.026, -5.881),
  349. path1: new THREE.Vector3(-85.618, 0.887, -12.862),
  350. isSpread: false,
  351. spreadDirection: 0,
  352. },
  353. {
  354. path0: new THREE.Vector3(-85.618, 0.887, -12.962),
  355. path1: new THREE.Vector3(80.404, 0.887, -12.962),
  356. isSpread: false,
  357. spreadDirection: 0,
  358. },
  359. {
  360. path0: new THREE.Vector3(80.404, 0.887, -12.962),
  361. path1: new THREE.Vector3(93.164, 0.91, -12.962),
  362. isSpread: true,
  363. spreadDirection: 1, // 1是由小变大,-1是由大变小
  364. },
  365. ];
  366. if (!topSmoke) {
  367. topSmoke = new Smoke('/model/img/texture-smoke.png', '#ffffff', 0, 0.8, 0.5, 400);
  368. topSmoke.setPath(topCurve);
  369. await topSmoke.setPoints();
  370. group?.add(topSmoke.points);
  371. }
  372. if (!downSmoke) {
  373. downSmoke = new Smoke('/model/img/texture-smoke.png', '#ffffff', 0, 0.8, 0.5, 400);
  374. downSmoke.setPath(downCurve);
  375. await downSmoke.setPoints();
  376. group?.add(downSmoke.points);
  377. }
  378. };
  379. const runFly = (deviceType, state) => {
  380. if (state === 'open') {
  381. if (deviceType === 'top') {
  382. if (downSmoke.frameId) {
  383. downSmoke.stopSmoke();
  384. }
  385. if (!topSmoke.frameId) {
  386. topSmoke.startSmoke();
  387. }
  388. } else {
  389. if (topSmoke.frameId) {
  390. topSmoke.stopSmoke();
  391. }
  392. if (!downSmoke.frameId) {
  393. downSmoke.startSmoke();
  394. }
  395. }
  396. } else {
  397. if (deviceType === 'top') {
  398. if (topSmoke.frameId) {
  399. topSmoke.stopSmoke();
  400. }
  401. } else {
  402. if (downSmoke.frameId) {
  403. downSmoke.stopSmoke();
  404. }
  405. }
  406. }
  407. };
  408. // 调频 30-50 (life 300 - 800) , 25 = (800 - 300)/ 20
  409. const setSmokeFrequency = (deviceType, frequency) => {
  410. const life = (frequency - 30) * 25;
  411. let duration = 0;
  412. let smoke;
  413. if (deviceType === 'top') {
  414. if (topLife == life) {
  415. return;
  416. }
  417. topLife = life;
  418. smoke = topSmoke;
  419. duration = (Math.abs(life - smoke.life) / 500) * 25;
  420. } else {
  421. if (downLife == life) {
  422. return;
  423. }
  424. downLife = life;
  425. smoke = downSmoke;
  426. duration = (Math.abs(life - smoke.life) / 500) * 25;
  427. }
  428. if (smoke) {
  429. gsap.to(smoke, {
  430. life: life,
  431. duration: duration,
  432. ease: 'easeInCubic',
  433. overwrite: true,
  434. });
  435. }
  436. };
  437. const clearFly = () => {
  438. if (topSmoke) topSmoke.clearSmoke();
  439. if (downSmoke) downSmoke.clearSmoke();
  440. };
  441. // 初始化事件
  442. const startAnimation = () => {
  443. // 定义鼠标点击事件
  444. model.canvasContainer?.addEventListener('mousedown', mouseEvent.bind(null));
  445. model.canvasContainer?.addEventListener('pointerup', mouseUp);
  446. };
  447. // 鼠标点击、松开事件
  448. const mouseEvent = (event) => {
  449. if (event.button == 0) {
  450. model?.canvasContainer?.addEventListener('mousemove', mousemove);
  451. mouseDownFn(<UseThree>model, <THREE.Object3D>group, event, (intersects) => {
  452. intersects.find((intersect) => {
  453. const mesh = intersect.object;
  454. if (mesh.name === 'player1') {
  455. if (new Date().getTime() - playerStartClickTime1 < 400) {
  456. // 双击,视频放大
  457. if (player1) {
  458. player1.requestFullscreen();
  459. }
  460. }
  461. playerStartClickTime1 = new Date().getTime();
  462. return true;
  463. }
  464. });
  465. });
  466. console.log('摄像头控制信息', model?.orbitControls, model?.camera);
  467. }
  468. };
  469. const mouseUp = () => {
  470. if (!model) return;
  471. mouseUpFn(model);
  472. model.canvasContainer?.removeEventListener('mousemove', mousemove);
  473. };
  474. const mousemove = () => {
  475. mousemoveFn();
  476. };
  477. export const mountedThree = (playerVal1) => {
  478. player1 = playerVal1;
  479. return new Promise((resolve) => {
  480. // model = new UseThree('#fanLocal3D', '#fanLocal3DCSS');
  481. model = new UseThree('#fanLocal3D');
  482. model.setEnvMap('test1');
  483. model.renderer.toneMappingExposure = 1.0;
  484. if (model.renderer) {
  485. model.renderer.sortObjects = true;
  486. }
  487. resetCamera();
  488. model.setGLTFModel([modelName]).then(async (gltf) => {
  489. group = <THREE.Object3D>gltf[0];
  490. const Fengtongbu01 = group?.getObjectByName('Cylinder1054') as THREE.Mesh;
  491. if (Fengtongbu01) {
  492. const textMaterial = new THREE.MeshBasicMaterial({
  493. color: '#000',
  494. transparent: true,
  495. opacity: 0.3,
  496. side: THREE.DoubleSide, // 这里是双面渲染的意思
  497. });
  498. Fengtongbu01.material = textMaterial;
  499. Fengtongbu01.renderOrder = 300;
  500. }
  501. model?.scene?.add(group);
  502. setModalPosition();
  503. setControls();
  504. await initFly();
  505. model?.animate();
  506. addLight(model?.scene);
  507. // fcFanObj = new fcFan(model);
  508. // await fcFanObj.mountedThree();
  509. // fmFanObj = new fmFan(model);
  510. // await fmFanObj.mountedThree();
  511. const videoPlayer1 = document.getElementById('jb-player1')?.getElementsByClassName('vjs-tech')[0];
  512. if (videoPlayer1) {
  513. const mesh = renderVideo(group, videoPlayer1, 'player1');
  514. if (mesh) {
  515. mesh.scale.set(0.222, 0.19, 0.2);
  516. mesh.position.set(-84.87, 0.298, 24.76);
  517. mesh.rotation.y = -Math.PI / 2;
  518. group.add(mesh);
  519. }
  520. } else {
  521. const textArr = [
  522. {
  523. text: `无信号输入`,
  524. font: 'normal 40px Arial',
  525. color: '#009900',
  526. strokeStyle: '#002200',
  527. x: 170,
  528. y: 40,
  529. },
  530. ];
  531. getTextCanvas(560, 346, textArr, '').then((canvas: HTMLCanvasElement) => {
  532. const textMap = new THREE.CanvasTexture(canvas); // 关键一步
  533. const textMaterial = new THREE.MeshBasicMaterial({
  534. map: textMap, // 设置纹理贴图
  535. transparent: true,
  536. side: THREE.DoubleSide, // 这里是双面渲染的意思
  537. });
  538. textMaterial.blending = THREE.CustomBlending;
  539. const monitorPlane = group?.getObjectByName('noPlayer');
  540. if (monitorPlane) {
  541. monitorPlane.material = textMaterial;
  542. } else {
  543. const planeGeometry = new THREE.PlaneGeometry(100, 100); // 平面3维几何体PlaneGeometry
  544. const planeMesh = new THREE.Mesh(planeGeometry, textMaterial);
  545. if (!videoPlayer1) {
  546. planeMesh.name = 'noPlayer';
  547. planeMesh.scale.set(0.07, 0.05, 0.07);
  548. planeMesh.position.set(-84.82, -1.53, 24.94);
  549. planeMesh.rotation.y = -Math.PI / 2;
  550. group?.add(planeMesh.clone());
  551. }
  552. }
  553. });
  554. }
  555. startAnimation();
  556. resolve(model);
  557. });
  558. });
  559. };
  560. export const destroy = () => {
  561. if (model) {
  562. model.isRender = false;
  563. console.log('场景销毁后信息----------->', model.renderer?.info);
  564. clearFly();
  565. topSmoke = undefined;
  566. downSmoke = undefined;
  567. if (fcFanObj) fcFanObj.destroy();
  568. if (fmFanObj) fmFanObj.destroy();
  569. group = undefined;
  570. model.destroy();
  571. model = undefined;
  572. }
  573. };