瀏覽代碼

制作1.5.0需求

bill 1 年之前
父節點
當前提交
6e868918aa

+ 19 - 4
src/util/image-rotate.ts

@@ -28,9 +28,7 @@ export const imageRotate = async (
   const ctx = canvas.getContext("2d")!;
 
   const center =
-    direction === "row"
-      ? [img.width / 2, height / 2]
-      : [img.height / 2, width / 2];
+    direction === "row" ? [img.width / 2, height / 2] : [img.height / 2, width / 2];
   ctx.translate(center[0], center[1]);
   ctx.rotate(((direction === "row" ? -1 : 1) * Math.PI) / 2);
   ctx.translate(-center[0], -center[1]);
@@ -41,13 +39,29 @@ export const imageRotate = async (
   );
 };
 
-export const fixImageSize = async (blob: Blob, max: number, min: number) => {
+export const fixImageSize = async (
+  blob: Blob,
+  max: number,
+  min: number,
+  scale = true
+) => {
   const img = new Image();
   img.src = URL.createObjectURL(blob);
   await new Promise((resolve) => (img.onload = resolve));
 
   let width = img.width;
   let height = img.height;
+  if (!scale) {
+    const diff = max - min;
+    if (width > max) {
+      max = width;
+      min = max - diff;
+    } else if (height > max) {
+      max = height;
+      min = max - diff;
+    }
+  }
+
   if (width > max) {
     height = (height / width) * max;
     width = max;
@@ -57,6 +71,7 @@ export const fixImageSize = async (blob: Blob, max: number, min: number) => {
   }
   let size = width > height ? width : height;
   size = size > min ? size : min;
+
   const $canvas = document.createElement("canvas");
   $canvas.width = size;
   $canvas.height = size;

+ 1 - 1
src/view/case/draw/slider.vue

@@ -79,7 +79,7 @@ const { percentage, upload, file, fileList, removeFile, accept } = useUpload({
 
 watchEffect(async () => {
   if (file.value) {
-    const newFile = (await fixImageSize(file.value, 500, 500)) || file.value;
+    const newFile = (await fixImageSize(file.value, 500, 500, false)) || file.value;
     const data = await imageCropper({ img: newFile, fixed: [500, 500] });
     data && emit("selectImage", data);
     removeFile();

+ 8 - 8
src/view/case/editMenu.vue

@@ -81,14 +81,14 @@ const menus = computed(() => {
         );
       },
     },
-    // {
-    //   key: "sync",
-    //   label: "带看",
-    //   onClick: async () => {
-    //     const href = await getSWKKSyncLink(caseId);
-    //     window.open(href);
-    //   },
-    // },
+    {
+      key: "sync",
+      label: "带看",
+      onClick: async () => {
+        const href = await getSWKKSyncLink(caseId);
+        window.open(href);
+      },
+    },
     {
       key: "share",
       label: "分享",

+ 8 - 0
src/view/vrmodel/modelContent.vue

@@ -46,6 +46,14 @@
     <el-table-column label="操作" v-slot:default="{ row }">
       <span
         class="oper-span"
+        v-pdpath="['edit']"
+        @click="openSceneUrl(row, OpenType.edit)"
+        v-if="row.createStatus === ModelSceneStatus.SUCCESS"
+      >
+        修改
+      </span>
+      <span
+        class="oper-span"
         v-pdpath="['view']"
         @click="openSceneUrl(row, OpenType.query)"
         v-if="row.createStatus === ModelSceneStatus.SUCCESS"

+ 1 - 1
src/view/vrmodel/sceneContent.vue

@@ -47,7 +47,7 @@
         class="oper-span"
         @click="genMeshScene(row)"
       >
-        生成mesh
+        生成obj
       </span>
 
       <span

+ 1 - 1
vite.config.ts

@@ -3,7 +3,7 @@ import vue from "@vitejs/plugin-vue";
 import { resolve } from "path";
 import ElementPlus from "unplugin-element-plus/vite";
 
-let app = "xmfire";
+let app = "criminal";
 if (process.argv.length > 3) {
   app = process.argv[process.argv.length - 1].trim();
 }