From 39dfd080674632b57f7436d7e9b4905c83a38af5 Mon Sep 17 00:00:00 2001
From: Santo Cariotti <santo@dcariotti.me>
Date: Sat, 24 Sep 2022 16:09:39 +0200
Subject: Use PreviewFile also in model index page

---
 components/FilePreview.vue | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

(limited to 'components/FilePreview.vue')

diff --git a/components/FilePreview.vue b/components/FilePreview.vue
index a738a93..5c0f3db 100644
--- a/components/FilePreview.vue
+++ b/components/FilePreview.vue
@@ -1,6 +1,6 @@
 <template lang="pug">
-  .file-preview
-    img(
+  .file-preview.h-full
+    img.h-full.block.mx-auto(
       v-if="isImage(path)"
       :src="baseAPI + '' + path"
     )
@@ -8,12 +8,14 @@
       v-else-if="isStl(path)"
       :rotate="rotate"
       :src="baseAPI + '' + path"
-      :backgroundColor="'#D1D5DB'"
+      :backgroundColor="bg ? bg : '#D1D5DB'"
+      :controlsOptions="{'enablePan': controls ? true : false, 'enableZoom': controls ? true : false, 'enableRotate': controls ? true : false}"
     )
     model-obj(
       v-else-if="isObj(path)"
       :src="baseAPI + '' + path"
-      :backgroundColor="'#D1D5DB'"
+      :backgroundColor="bg ? bg : '#D1D5DB'"
+      :controlsOptions="{'enablePan': controls ? true : false, 'enableZoom': controls ? true : false, 'enableRotate': controls ? true : false}"
     )
 </template>
 
@@ -22,7 +24,7 @@ import { ModelStl, ModelObj } from "vue-3d-model";
 
 export default {
   name: "FilePreview",
-  props: ["path"],
+  props: ["path", "bg", "controls"],
   data() {
     return {
       baseAPI: "",
-- 
cgit v1.2.3-18-g5258

