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/drawer/shelf/shelfThree.js
@@ -167,8 +167,35 @@ destroy = () => { cancelAnimationFrame(this.animationFrame); window.removeEventListener('resize', this.resizeHandler); this.renderer.dispose(); this.controls.dispose(); if (this.scene) { while (this.scene.children.length > 0) { this.removeEntity(this.scene.children[0]); } this.scene = null; } if (this.renderer) { this.renderer.dispose(); this.renderer.forceContextLoss(); this.renderer.context = null; this.renderer.domElement = null; this.renderer = null; } if (this.controls) { this.controls.dispose(); this.controls = null; } this.camera = null; this.objects = []; while (this.dom?.firstChild) { this.dom.removeChild(this.dom.firstChild); } } removeEntity = (object) => { if (object.material) object.material.dispose(); if (object.geometry) object.geometry.dispose(); if (object.texture) object.texture.dispose(); this.scene.remove(object); } }; zy-asrs-flow/src/pages/map/drawer/shelf/view.jsx
@@ -23,20 +23,30 @@ const intl = useIntl(); const { styles } = useStyles(); const refContainer = useRef(); const [loading, setLoading] = React.useState(true); const [loading, setLoading] = React.useState(false); const startThree = () => { shelfThree = new ShelfThree(refContainer.current); shelfThree.startup(); } const endThree = () => { if (shelfThree) { shelfThree.destroy(); shelfThree = null; } } useEffect(() => { console.log(props); setLoading(true); endThree(); setTimeout(() => { setLoading(false); shelfThree = new ShelfThree(refContainer.current); shelfThree.startup(); }, 1000) startThree(); }, 300) return () => { shelfThree?.destroy(); } }, [props]); return endThree; }, [props.data.uuid]); return ( <>