diff --git a/src/designer/Viewport.ts b/src/designer/Viewport.ts
index 8ed2e73..81431c5 100644
--- a/src/designer/Viewport.ts
+++ b/src/designer/Viewport.ts
@@ -21,6 +21,7 @@ export default class Viewport {
statsControls: Stats
controls: OrbitControls
worldModel: WorldModel
+ animationFrameId: any = null
/**
* 监听窗口大小变化
@@ -46,7 +47,9 @@ export default class Viewport {
/**
* 初始化 THREE 渲染器
*/
- initThree(viewerDom: HTMLElement) {
+ initThree(viewerDom: HTMLElement, floor: string) {
+ console.log('init floor', floor)
+ this.state.currentFloor = floor
this.viewerDom = viewerDom
this.worldModel.registerViewport(this)
@@ -195,7 +198,7 @@ export default class Viewport {
* 动画循环
*/
animate() {
- requestAnimationFrame(this.animate.bind(this))
+ this.animationFrameId = requestAnimationFrame(this.animate.bind(this))
this.renderView()
}
@@ -282,6 +285,11 @@ export default class Viewport {
destroy() {
this.state.isReady = false
+ if (this.animationFrameId !== null) {
+ cancelAnimationFrame(this.animationFrameId)
+ this.animationFrameId = null
+ }
+
if (this.unwatchList) {
_.forEach(this.unwatchList, (unWatchFn => {
unWatchFn()
diff --git a/src/designer/model2DEditor/Model2DEditor.vue b/src/designer/model2DEditor/Model2DEditor.vue
index d1dcd97..0e9a4a4 100644
--- a/src/designer/model2DEditor/Model2DEditor.vue
+++ b/src/designer/model2DEditor/Model2DEditor.vue
@@ -4,13 +4,15 @@