Bladeren bron

fix: 修改打包路径

bill 2 maanden geleden
bovenliggende
commit
ec0eb312bd

+ 1 - 0
.env.jmdev

@@ -4,6 +4,7 @@ VITE_ENTRY='/example/fuse/enter.ts'
 VITE_ENTRY_EXAMPLE='./main.ts'
 VITE_MOCK_ENV=jmtest
 
+
 VITE_STATIC='http://192.168.0.25'
 VITE_OSS='/oss/'
 VITE_OSS_ROOT="/rootOss/"

+ 0 - 1
package.json

@@ -9,7 +9,6 @@
     "build:fuse": "vite build --mode=fuse",
 
     "dev:jm": "vite --mode=jmdev",
-    "build:jmtest": "vite build --mode=jmtest",
     "build:jm": "vite build --mode=jm"
   },
   "dependencies": {

File diff suppressed because it is too large
+ 1 - 7
public/styles/style-8.svg


File diff suppressed because it is too large
+ 7 - 1
public/styles/style-9.svg


+ 0 - 1
src/core/components/group/temp-group.vue

@@ -43,7 +43,6 @@ const updateBound = () => {
     console.error("!shapes");
     return;
   }
-  console.log(shapes);
   let lx = Number.MAX_VALUE;
   let ly = Number.MAX_VALUE;
   let rx = Number.MIN_VALUE;

+ 0 - 3
src/core/hook/use-draw.ts

@@ -254,7 +254,6 @@ const useInteractiveDrawTemp = <T extends ShapeType>({
       quitDrawShape();
       clear();
       quit && quit();
-      console.error('quitDrawShape')
     },
     enter,
     beforeHandler: (p) => {
@@ -290,7 +289,6 @@ const useInteractiveDrawTemp = <T extends ShapeType>({
     item = reactive(item);
 
     const storeAddItem = (cItem: any) => {
-      console.error('storeAddItem')
       const items = store.getTypeItems(type);
       if (items.some((item) => item.id === cItem.id)) {
         store.setItem(type, { id: cItem.id, value: cItem });
@@ -316,7 +314,6 @@ const useInteractiveDrawTemp = <T extends ShapeType>({
       watch(
         cur,
         () => {
-          console.log('emm')
           obj.interactiveFixData({
             info: {
               cur,

+ 1 - 0
src/example/fuse/views/overview/slide-icons.vue

@@ -50,6 +50,7 @@ const drawIcon = async (url: string, name: string, item: any) => {
     size.width = (maxSize / svgContent.height) * svgContent.width;
   }
 
+  console.log(svgContent.width, svgContent.height);
   const color = {
     fill: svgContent.paths[0]?.fill,
     stroke: svgContent.paths[0]?.stroke,

+ 1 - 0
src/example/platform/platform-draw.ts

@@ -316,6 +316,7 @@ const drawLayerResource = async (
             }
             if (svg.width && svg.height) {
               if (svg.width > svg.height) {
+                console.log(item.url, svgAttach.width, svg.height / svg.width)
                 svgAttach.height = (svg.height / svg.width) * svgAttach.width;
               }
             }

+ 41 - 6
src/example/platform/platform-resource.ts

@@ -2,7 +2,7 @@ import { Pos, Size } from "@/utils/math";
 import { extractConnectedSegments } from "@/utils/polygon";
 import { validNum } from "@/utils/shared";
 import { aiIconMap, iconGroups } from "../constant";
-import { Euler, Quaternion } from "three";
+import { Euler, MathUtils, Object3D, Quaternion, Vector3 } from "three";
 
 export enum SCENE_TYPE {
   fuse = "fuse",
@@ -45,7 +45,7 @@ export type Taging = {
   rotate?: number;
   name?: string;
   pixel?: boolean;
-  isText?: boolean
+  isText?: boolean;
   subgroup?: string;
 };
 
@@ -82,6 +82,38 @@ export const getSceneApi = async (type: string | undefined, url: string) => {
 
 export type Tagings = Taging[];
 
+const getBillYaw = (bill: any) => {
+  function isLieDown(quaternion: Quaternion) {
+    let direction = new Vector3(0, 0, -1).applyQuaternion(quaternion);
+    return Math.abs(direction.y) > 0.9;
+  }
+
+  let billboard = new Object3D();
+  let plane = new Object3D();
+  billboard.add(plane);
+  billboard.quaternion.copy({x: bill.qua[0], y: bill.qua[1], z: bill.qua[2], w: bill.qua[3]}).normalize(); //qua数据里的
+  plane.quaternion.setFromAxisAngle(
+    new Vector3(0, 0, 1),
+    MathUtils.degToRad(-bill.faceAngle)
+  );
+
+  const up = new Vector3(0, 1, 0); //plane的上方指示着方向
+  const right = new Vector3(1, 0, 0); //令躺倒时的旋转轴
+
+  let qua = plane.getWorldQuaternion(new Quaternion());
+  const ld = isLieDown(billboard.quaternion)
+  if (!ld) {
+    //使朝其后方躺倒后再求angle
+    let rotAxis = right.clone().applyQuaternion(qua); //旋转轴
+    (rotAxis.y = 0), rotAxis.normalize();
+    let rot = new Quaternion().setFromAxisAngle(rotAxis, Math.PI / 2);
+    qua.premultiply(rot);
+  }
+  let dir = up.clone().applyQuaternion(qua); //在墙面朝x时正反得到的一样,很奇怪,所以得到的会反向
+  let yaw = Math.atan2(-dir.z, dir.x) - Math.PI / 2;
+  return -yaw;
+};
+
 export const compassGets = {
   [SCENE_TYPE.fuse]: () => void 0,
   [SCENE_TYPE.cloud]: () => void 0,
@@ -222,9 +254,10 @@ export const taggingGets = {
                 );
               })
             : getSceneApi("oss", `${prev}/user/${signage.icon}`);
-        const q = new Quaternion(...signage.qua);
-        const yRotate = new Euler().setFromQuaternion(q, "XYZ").y + Math.PI;
 
+        const yRotate = getBillYaw(signage)
+
+        console.log(signage)
         return getIcon
           .then((url) => {
             tags.push({
@@ -284,12 +317,14 @@ export const taggingGets = {
                 }
               }
             }
-            const isTag = icon === 'Tag'
+            const isTag = icon === "Tag";
             if (name || isTag) {
               tags.push({
                 isText: isTag,
                 position: pos,
-                url: isTag ? shape.name : `./icons/${icon ? icon : "circle"}.svg`,
+                url: isTag
+                  ? shape.name
+                  : `./icons/${icon ? icon : "circle"}.svg`,
                 name,
                 pixel: true,
                 size,