summaryrefslogtreecommitdiff
path: root/components
diff options
context:
space:
mode:
authorSanto Cariotti <santo@dcariotti.me>2022-09-24 16:09:39 +0200
committerSanto Cariotti <santo@dcariotti.me>2022-09-24 16:09:39 +0200
commit39dfd080674632b57f7436d7e9b4905c83a38af5 (patch)
tree04ba6c4686091f25a19f7059c502a135d1c8108e /components
parent6c870e85cc152cb83855e74e1fc93302c6f96fe2 (diff)
Use PreviewFile also in model index page
Diffstat (limited to 'components')
-rw-r--r--components/FilePreview.vue12
-rw-r--r--components/ModelForm.vue2
2 files changed, 8 insertions, 6 deletions
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: "",
diff --git a/components/ModelForm.vue b/components/ModelForm.vue
index ea1d3c3..442c0ba 100644
--- a/components/ModelForm.vue
+++ b/components/ModelForm.vue
@@ -5,7 +5,7 @@
.fixed.inset-0.z-10.overflow-y-auto
.flex.min-h-full.items-center.justify-center.p-4.text-center
.relative.transform.overflow-hidden.rounded-lg.bg-white.shadow-xl.transition-all(class="w-10/12 sm:w-8/12")
- file-preview(:path="openPreview")
+ file-preview(:path="openPreview" controls="1")
.bg-gray-50.px-4.py-3(class="sm:flex sm:flex-row-reverse sm:px-6")
button.mt-3.inline-flex.w-full.justify-center.rounded-md.border.border-gray-300.bg-white.px-4.py-2.text-base.font-medium.text-gray-700.shadow-sm(
type="button"