zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
zy-asrs-flow/src/pages/map/utils.js | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
zy-asrs-flow/src/pages/map/drawer/shelf/shelfThree.js
@@ -97,7 +97,7 @@ controls.minPolarAngle = 0; // 最小俯仰角度(向下看) controls.maxPolarAngle = Math.PI / 2.1; // 最大俯仰角度(向上看) controls.rotateSpeed = 0.6; // 视角移动速度减慢 controls.autoRotate = true; // 自动旋转 controls.autoRotate = false; // 自动旋转 controls.target = new THREE.Vector3(0, 250, 0) // 屏幕中心点 平替 camera的lookAt return controls; @@ -125,7 +125,6 @@ let that = this; const raycaster = new THREE.Raycaster(); const mouse = new THREE.Vector2(); this.dom.addEventListener("dblclick", (event) => { }) this.dom.addEventListener("click", (event) => { @@ -137,22 +136,18 @@ x = event.clientX; y = event.clientY; } let rect = this.dom.getBoundingClientRect(); mouse.x = ((x - rect.left) / rect.width) * 2 - 1; mouse.y = -((y - rect.top) / rect.height) * 2 + 1; event.preventDefault(); // mouse.x = (x / this.getFullWidth()) * 2 - 1; // mouse.y = -(y / this.getFullHeight()) * 2 + 1; mouse.x = (x / window.innerWidth) * 2 - 1; mouse.y = -(y / window.innerHeight) * 2 + 1; raycaster.setFromCamera(mouse, that.camera); let intersects = raycaster.intersectObjects(that.objects, true); console.log(intersects); if (intersects.length === 0) { return; } let objName = intersects[0].object.name; if (objName.startsWith("locNo")) { if (this.handleClick) { this.handleClick(objName, x, y); } if (objName && this.handleClick) { this.handleClick(objName, x, y); } }, false); } zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
@@ -80,6 +80,7 @@ const shelfMesh = new THREE.Mesh(new THREE.BoxGeometry(100, 40, 100), new THREE.MeshStandardMaterial({ color: '#006266', })); shelfMesh.name = item.locNo; shelfMesh.position.set(0, 20 + 100 * (lev - 1), 0); addObject(shelfMesh) @@ -87,6 +88,7 @@ const palletMesh = new THREE.Mesh(new THREE.BoxGeometry(100, 60, 100), new THREE.MeshStandardMaterial({ color: '#2c2c54', })); palletMesh.name = item.locNo; palletMesh.position.set(0, 70 + 100 * (lev - 1), 0); addObject(palletMesh) } @@ -96,11 +98,9 @@ setTimeout(() => { startThree(refContainer.current); shelfThree.handleClick = (str) => { console.log(str); shelfThree.handleClick = (locNo) => { setCurLocNo(locNo); } fetchShelfInfo(props.locNo); setLoading(false); }, 300) zy-asrs-flow/src/pages/map/utils.js
@@ -578,4 +578,8 @@ bay: locParseArr?.[1], lev: locParseArr?.[2], } } export const generateLocNo = (row, bay, lev) => { return row + '-' + bay + '-' + lev; }