feat(viewer/frontend): extra integration legwork

This commit is contained in:
Dimitrie Stefanescu
2022-08-25 10:28:48 +03:00
parent ba5f249cef
commit f378d88c19
9 changed files with 32 additions and 27 deletions
@@ -405,7 +405,6 @@ export default {
sectionBox: this.viewer.sectionBox.getCurrentBox(),
selection: null // TODO for later, lazy now
},
//@Dim: Changed this to use the API
screenshot: this.viewer.screenshot()
}
if (this.$route.query.overlay) {
@@ -446,7 +445,6 @@ export default {
this.visible = false
this.commentValue = { doc: null, attachments: [] }
setIsAddingComment(false)
//@Dim: Changed this to use the API
this.viewer.resetSelection()
},
sendStatusUpdate() {
@@ -516,14 +516,17 @@ export default {
if (camToSet[6] === 1) {
this.viewer.toggleCameraProjection()
}
//@Dim: This needs to use the API.
// this.viewer.interactions.setLookAt(
// { x: camToSet[0], y: camToSet[1], z: camToSet[2] }, // position
// { x: camToSet[3], y: camToSet[4], z: camToSet[5] } // target
// )
if (camToSet[6] === 1) {
this.viewer.cameraHandler.activeCam.controls.zoom(camToSet[7], true)
}
this.viewer.setView({
position: new THREE.Vector3(camToSet[0], camToSet[1], camToSet[2]),
target: new THREE.Vector3(camToSet[3], camToSet[4], camToSet[5])
})
// TODO: If it's an isometric cam.
// NOTE: currently not supported as parallel cam is disabled due to
// comment bubbles projection complications.
// if (camToSet[6] === 1) {
// this.viewer.cameraHandler.activeCam.controls.zoom(camToSet[7], true)
// }
if (comment.data.filters) {
setFilterDirectly({
filter: comment.data.filters
@@ -1,10 +1,5 @@
<template>
<v-card>
<!-- <v-toolbar dark flat>
<v-toolbar-title>Lighting Settings</v-toolbar-title>
<v-spacer></v-spacer>
<v-btn icon @click="$emit('close')"><v-icon>mdi-close</v-icon></v-btn>
</v-toolbar> -->
<v-card-text>
<div class="d-flex align-center">
<span class="mr-5">Sun shadows</span>
@@ -17,8 +17,8 @@
@click.stop="
prop.type === 'object' || prop.type === 'array' ? (expanded = !expanded) : null
"
@mouseenter="toggleHighlight(true)"
@mouseleave="toggleHighlight(false)"
@mouseenter.stop="toggleHighlight(true)"
@mouseleave.stop="toggleHighlight(false)"
>
<v-col cols="1" class="text-center">
<v-icon
@@ -254,14 +254,15 @@ export default {
if (camToSet[6] === 1) {
this.viewer.toggleCameraProjection()
}
//@Dim: This needs to use the API
// this.viewer.interactions.setLookAt(
// { x: camToSet[0], y: camToSet[1], z: camToSet[2] }, // position
// { x: camToSet[3], y: camToSet[4], z: camToSet[5] } // target
// )
if (camToSet[6] === 1) {
this.viewer.cameraHandler.activeCam.controls.zoom(camToSet[7], true)
}
this.viewer.setView({
position: new THREE.Vector3(camToSet[0], camToSet[1], camToSet[2]),
target: new THREE.Vector3(camToSet[3], camToSet[4], camToSet[5])
})
// NOTE: disabled as parallel projection cam is not enabled anymore, see other comments
// if (camToSet[6] === 1) {
// this.viewer.cameraHandler.activeCam.controls.zoom(camToSet[7], true)
// }
if (user.filter) setFilterDirectly({ filter: user.filter })
else resetFilter()
@@ -468,6 +469,7 @@ export default {
uArrowEl.style.opacity = user.clipped ? '0' : '1'
}
//@Dim: This shouldn't be needed anymore, right?
// TODO: user filtering manager to overlay objects
// this.viewer.interactions.overlayObjects(selectedObjects)
}
}
+3 -2
View File
@@ -26,13 +26,14 @@ async function pageFunction(objectUrl) {
// Main call failed. Wait some time for other objects to load inside the viewer and generate the preview anyway
await waitForAnimation(1000)
}
//@Dim: This needs to use the API
// v.interactions.zoomExtents(0.95, false)
v.zoomExtents(0.95, false)
await waitForAnimation(100)
// full 360
for (let i = 0; i < 24; i++) {
//@Dim: This needs to use the API
//@Alex: we really need the old behaviour here - it rotates the camera around the scene in increments of
//an angle and we stich those screenshots for the 3d previews...
// v.interactions.rotateCamera(undefined, undefined, false)
await waitForAnimation()
//@Dim: Changed this to use the API
@@ -134,12 +134,14 @@ export default class SectionBox {
if (val) {
this.dragging = val
//@Dim: Not sure what this needs to do in the new viewer
//@Alex: this prevents(?) involuntary selection happening on mobile
// this.viewer.interactions.preventSelection = val
this.viewer.cameraHandler.enabled = !val
} else {
setTimeout(() => {
this.dragging = val
//@Dim: Not sure what this needs to do in the new viewer
//@Alex: this prevents(?) involuntary selection happening on mobile
// this.viewer.interactions.preventSelection = val
this.viewer.cameraHandler.enabled = !val
}, 100)
@@ -353,6 +355,8 @@ export default class SectionBox {
if (targetBox) box = targetBox
else {
// @Alex: part of the old behaviour: if a selected object is present, we zoom to it
// if no selection is present, we zoom to visible scene. TBD re API, etc.
/* //@Dim: Not sure what this needs to do in the new viewer
if (this.viewer.interactions.selectedObjects.children.length !== 0) {
box = new THREE.Box3().setFromObject(this.viewer.interactions.selectedObjects)
@@ -395,6 +395,7 @@ export class FilteringManager {
}
this.Renderer.endFilter()
this.Renderer.viewer.needsRender = true
return returnState
}
@@ -52,6 +52,7 @@ v.on('section-box', (status) => {
})
window.viewerScreenshot = function () {
//@Alex: we can get rid of the whole example.js/html stuff (sandbox is the replacement)
//@Dim: Changed this to use the API
let data = v.screenshot() // transparent png.