Skip to content

Commit

Permalink
refactor: use vite MODE env to determine debug logs
Browse files Browse the repository at this point in the history
  • Loading branch information
saw-jan committed Oct 14, 2024
1 parent 6f27332 commit f044327
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
17 changes: 8 additions & 9 deletions src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ let iniCamPosition: Vector3 | null = null
let iniCamZPosition: number = 0
const iniCamRotation: Euler = new Euler(0, 0, 0)
const animTimeoutSec = 1
const debugIsEnabled = false
// =====================
// props
Expand Down Expand Up @@ -246,7 +245,9 @@ async function renderModel(extension: string) {
}
})
debug(model)
if (import.meta.env.MODE === 'development') {
debug(model)
}
const box = new Box3()
if (!model.hasOwnProperty('scene') && extension === 'stl') {
Expand Down Expand Up @@ -437,13 +438,11 @@ function resetModelPosition() {
}
}
function debug(output) {
if (debugIsEnabled) {
scene.add(new AxesHelper(10))
console.log('####### DEBUG 3D MODEL #######')
console.log(output)
console.log('#####################')
}
function debug(model: object) {
scene.add(new AxesHelper(10))
console.log('####### DEBUG 3D MODEL #######')
console.log(model)
console.log('#####################')
}
</script>

Expand Down
2 changes: 2 additions & 0 deletions vite-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/// <reference types="vite/client" />
/// <reference types="vite/types/importMeta.d.ts" />

0 comments on commit f044327

Please sign in to comment.