From bce6b15d7acdf2df94ff24c8f6ea97088662944b Mon Sep 17 00:00:00 2001 From: Dimitrie Stefanescu Date: Thu, 24 Feb 2022 17:01:09 +0000 Subject: [PATCH] feat(bubbles): no-selection comments logic --- .../components/viewer/CommentAddOverlay.vue | 39 ++++++++++++------- .../main/pages/stream/CommitObjectViewer.vue | 2 +- 2 files changed, 27 insertions(+), 14 deletions(-) diff --git a/packages/frontend/src/main/components/viewer/CommentAddOverlay.vue b/packages/frontend/src/main/components/viewer/CommentAddOverlay.vue index ce6224d3e..68370e245 100644 --- a/packages/frontend/src/main/components/viewer/CommentAddOverlay.vue +++ b/packages/frontend/src/main/components/viewer/CommentAddOverlay.vue @@ -9,8 +9,8 @@ :class="`absolute-pos comment-overlay rounded-xl ${expand ? 'expanded' : ''}`" :style="`${!expand ? 'display:none; pointer-events:none;' : ''}`" > -
- +
+
- - mdi-comment-plus - mdi-close - + + + mdi-comment-plus + mdi-close + +
@@ -76,12 +79,15 @@ export default { }, methods: { async addComment() { + let camTarget = window.__viewer.cameraHandler.activeCam.controls.getTarget() let commentInput = { streamId: this.$route.params.streamId, resources: [this.$route.params.resourceId], text: this.commentText, data: { - location: this.location, + location: this.location + ? this.location + : new THREE.Vector3(camTarget.x, camTarget.y, camTarget.z), camPos: getCamArray(), filters: null, // TODO sectionBox: null, // TODO @@ -110,12 +116,19 @@ export default { toggleExpand() { this.$refs.commentOverlay.style.transition = 'all 0.1s ease' this.expand = !this.expand + if (this.expand && !this.location) { + // TODO: put in middle of screen? + this.$refs.commentOverlay.style.top = `50%` + this.$refs.commentOverlay.style.left = `50%` + this.$refs.commentOverlay.style.transform = `translate(-50%, -50%)` + } }, handleSelect(info) { if (!info.location) { // TODO: deselect event this.expand = false this.visible = false + this.location = null return } if (!this.$refs.commentButton) return diff --git a/packages/frontend/src/main/pages/stream/CommitObjectViewer.vue b/packages/frontend/src/main/pages/stream/CommitObjectViewer.vue index 0fe13419f..b7ed344e9 100644 --- a/packages/frontend/src/main/pages/stream/CommitObjectViewer.vue +++ b/packages/frontend/src/main/pages/stream/CommitObjectViewer.vue @@ -143,8 +143,8 @@ class="" > - +