From 11286a685e76ae01d44944976c197aad217d40d2 Mon Sep 17 00:00:00 2001 From: LinkunGao Date: Mon, 30 Sep 2024 16:30:24 +1300 Subject: [PATCH] fix listener bugs in 2d and 3d --- frontend/components/model/Model.vue | 24 ++++++++------------- frontend/components/model/PanelControls.vue | 5 ++++- frontend/plugins/copper.js | 1 + 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/frontend/components/model/Model.vue b/frontend/components/model/Model.vue index efcb360..85fe477 100644 --- a/frontend/components/model/Model.vue +++ b/frontend/components/model/Model.vue @@ -69,9 +69,9 @@ export default { }, created: async function () { - this.$nuxt.$on("send-emitter-data", (data) => { - console.log(data); - }); + // this.$nuxt.$on("send-emitter-data", (data) => { + // console.log(data); + // }); }, computed: { @@ -90,20 +90,14 @@ export default { this.modelData = this.$modelData(); this.container = this.$refs.baseDomObject; this.modelName = this.$model().name; - this.$nuxt.$emit("onNavChange", this.modelName); + if(["cyst", "fibroadenoma", "calcifications", "fat_necrosis", "dcis", "lobular", "ductal"].includes(this.modelName)){ + this.modelName = "normal"; + } - - - // setTimeout(() => { - // this.mdAndUp - // ? (baseContainer.style.height = "100vh") - // : (baseContainer.style.height = "100vw"); - // this.container.appendChild(baseContainer); - // this.start(); - // }, 100); + this.$nuxt.$emit("onNavChange", this.modelName); this.container.appendChild(this.baseContainer); - this.start(); + this.start(); window.addEventListener("resize", () => { setTimeout(() => { @@ -219,7 +213,7 @@ export default { }, removeContainerListener() { if(this.mouseActions !== null){ - this.container.addEventListener("mousemove", this.mouseActions.mouseMove); + this.container.removeEventListener("mousemove", this.mouseActions.mouseMove); this.container.removeEventListener("mousedown", this.mouseActions.mouseDown); this.container.removeEventListener("mouseup", this.mouseActions.mouseUp); } diff --git a/frontend/components/model/PanelControls.vue b/frontend/components/model/PanelControls.vue index 6045000..4438fc2 100644 --- a/frontend/components/model/PanelControls.vue +++ b/frontend/components/model/PanelControls.vue @@ -58,6 +58,9 @@ export default { this.container.appendChild(this.baseContainer); // Write code after mount this component this.modelName = this.$model().name; + if(["cyst", "fibroadenoma", "calcifications", "fat_necrosis", "dcis", "lobular", "ductal"].includes(this.modelName)){ + this.modelName = "normal"; + } this.start(); @@ -69,7 +72,7 @@ export default { }, methods: { - async start() { + start() { this.loadNrrd(this.modelUrlsArray[this.modelName][0], this.modelName+"right_mri"); }, diff --git a/frontend/plugins/copper.js b/frontend/plugins/copper.js index 753cf0d..43c7537 100644 --- a/frontend/plugins/copper.js +++ b/frontend/plugins/copper.js @@ -78,6 +78,7 @@ const raycaster = (scene, container, nrrdSliceZ, nrrdMesh, nrrdMaxIndex) => { } const mouseMove = (event) => { const a = scene.pickSpecifiedModel(nrrdMesh, {x: event.offsetX, y: event.offsetY}); + if(!!a.intersectedObject){ if(!findMesh){ scene.controls.noRotate = true;