fix(frontend): adds obj selection handler to object viewer

This commit is contained in:
Dimitrie Stefanescu
2021-05-11 09:37:03 +01:00
parent 49a3723dff
commit e21dc4b656
+33 -2
View File
@@ -2,9 +2,28 @@
<v-row>
<v-col cols="12" sm="12">
<v-card class="pa-0" elevation="0" rounded="lg" color="transparent" style="height: 50vh">
<renderer :object-url="commitObjectUrl" />
<renderer :object-url="commitObjectUrl" @selection="handleSelection" />
</v-card>
<v-card class="pa-4 mt-3" elevation="0" rounded="lg">
<v-expand-transition>
<v-sheet v-show="selectionData.length !== 0" class="pa-0" color="transparent">
<v-card-title class="mr-8">
<v-badge inline :content="selectionData.length">
<v-icon class="mr-2">mdi-cube</v-icon>
Selection
</v-badge>
</v-card-title>
<div v-if="selectionData.length !== 0">
<object-simple-viewer
v-for="(obj, ind) in selectionData"
:key="obj.id + ind"
:value="obj"
:stream-id="$route.params.streamId"
:key-name="`Selected Object ${ind + 1}`"
/>
</div>
</v-sheet>
</v-expand-transition>
<v-card-title class="mr-8">
<v-icon class="mr-2">mdi-database</v-icon>
Object {{ $route.params.objectId }}
@@ -23,11 +42,17 @@
</template>
<script>
import ObjectSpeckleViewer from '../components/ObjectSpeckleViewer'
import ObjectSimpleViewer from '../components/ObjectSimpleViewer'
import Renderer from '../components/Renderer'
export default {
name: 'ObjectViewer',
components: { ObjectSpeckleViewer, Renderer },
components: { ObjectSimpleViewer, ObjectSpeckleViewer, Renderer },
data() {
return {
selectionData: []
}
},
computed: {
commitObject() {
return {
@@ -39,6 +64,12 @@ export default {
commitObjectUrl() {
return `${window.location.origin}/streams/${this.$route.params.streamId}/objects/${this.$route.params.objectId}`
}
},
methods: {
handleSelection(selectionData) {
this.selectionData.splice(0, this.selectionData.length)
this.selectionData.push(...selectionData)
}
}
}
</script>