bill 2 тижнів тому
батько
коміт
bcc1605d95

+ 17 - 1
src/core/components/group/group.vue

@@ -42,7 +42,7 @@ import { useForciblyShowItemIds, useStage } from "@/core/hook/use-global-vars.ts
 import { themeColor } from "@/constant";
 import { debounce } from "@/utils/shared.ts";
 import { useComponentsDescribes } from "@/core/hook/use-group.ts";
-import { components } from "../index.ts";
+import { components, ShapeType } from "../index.ts";
 
 const props = defineProps<{ data: GroupData }>();
 const emit = defineEmits<{
@@ -75,12 +75,28 @@ const setPropertyDatas = computed(() => {
   const keys = Object.keys(descs.value);
   return keys.length === 0 ? [] : descs.value[keys[0]].joins;
 });
+
+const similars = {
+  形状: ["rectangle", "circle", "triangle", "polygon"],
+} as Record<string, ShapeType[]>;
+
 const propertyName = computed(() => {
+  const types = new Set<ShapeType>();
   const names = new Set<string>();
   for (const id of selectIds.value) {
     const belong = getShapeBelong(id);
     if (belong?.type) {
       names.add(components[belong.type].shapeName);
+      types.add(belong.type);
+    }
+  }
+  if (types.size > 1) {
+    const typeArr = [...types];
+    const target = Object.entries(similars).find(([_, similar]) =>
+      typeArr.every((t) => similar.includes(t))
+    );
+    if (target) {
+      return target[0];
     }
   }
   return [...names].join("、") || "多实现";

+ 13 - 13
src/core/components/line-icon/icon.vue

@@ -178,7 +178,7 @@ watch(
 
       const eq0 = eqPoint(oldLine[0], line[0]);
       const eq1 = eqPoint(oldLine[1], line[1]);
-      if (eq0 !== eq1) {
+      if (!eq0 || !eq1) {
         // 联动
         const startNdx = eq0 ? 0 : 1;
         const endNdx = eq0 ? 1 : 0;
@@ -214,22 +214,22 @@ watch(
   },
   { immediate: true, flush: "post" }
 );
-operateMenus.splice(3, 1);
+operateMenus.splice(0, 4);
 if (props.data.type === "align-bottom" || props.data.type === "align-bottom-fix") {
   operateMenus.splice(
-    operateMenus.length - 1,
+    operateMenus.length - 2,
     0,
+    // {
+    //   label: "内外翻转",
+    //   handler: () => {
+    //     emit("updateShape", {
+    //       ...data.value,
+    //       openSide: data.value.openSide === "LEFT" ? "RIGHT" : "LEFT",
+    //     });
+    //   },
+    // },
     {
-      label: "内外翻转",
-      handler: () => {
-        emit("updateShape", {
-          ...data.value,
-          openSide: data.value.openSide === "LEFT" ? "RIGHT" : "LEFT",
-        });
-      },
-    },
-    {
-      label: "左右翻转",
+      label: "翻转",
       handler: () => {
         emit("updateShape", {
           ...data.value,

+ 0 - 1
src/core/components/line/attach-server.ts

@@ -610,7 +610,6 @@ export const useLineDescribes = (line: Ref<LineDataLine>) => {
       return lineLen(points.value[0], points.value[1]);
     },
     set value(val) {
-      console.log(val, d.length.isChange);
       if (!d.isChange) {
         setLineVector = lineVector(points.value);
       }

+ 1 - 2
src/core/components/line/single-line.vue

@@ -83,7 +83,7 @@
 <script lang="ts" setup>
 import EditLine from "../share/edit-line.vue";
 import singlePoint from "./single-point.vue";
-import { computed, onUnmounted, ref, watchEffect } from "vue";
+import { computed, ref } from "vue";
 import { getMouseStyle, LineData, LineDataLine, shapeName, renderer } from "./index.ts";
 import { onlyId } from "@/utils/shared.ts";
 import { Pos } from "@/utils/math.ts";
@@ -94,7 +94,6 @@ import { PropertyUpdate, Operate } from "../../html-mount/propertys/index.ts";
 import {
   useAnimationMouseStyle,
   useMouseShapesStatus,
-  useMouseShapeStatus,
 } from "@/core/hook/use-mouse-status.ts";
 import { themeColor } from "@/constant";
 import {

+ 15 - 2
src/core/hook/use-group.ts

@@ -2,6 +2,8 @@ import { computed, reactive, ref, Ref, watchEffect } from "vue";
 import { PropertyDescribes } from "../html-mount/propertys";
 import { installGlobalVar } from "./use-global-vars";
 import { inRevise, mergeFuns } from "@/utils/shared";
+import { useStore } from "../store";
+import { ShapeType } from "../components";
 
 export const useGlobalDescribes = installGlobalVar(() => {
   const shapesDescribes: Record<string, PropertyDescribes> = reactive({});
@@ -37,21 +39,32 @@ export const useGlobalDescribes = installGlobalVar(() => {
 
 export const useComponentsDescribes = (ids: Ref<string[]>) => {
   const gdesc = useGlobalDescribes();
+  const store = useStore()
   const excludeKeys = ["length", "name"];
   const groups = computed(() => {
-    return ids.value.map((id) => gdesc.get(id)).filter((item) => !!item);
+    return ids.value.map((id) => gdesc.get(id)).filter((item) => !!item).map(item => ({...item, type: store.getType(item.data.id)}));
   });
+  const similars = [
+    ['rectangle', 'circle', 'triangle', 'polygon']
+  ] as ShapeType[][]
+
   const shareDescribes = computed(() => {
     if (groups.value.length === 0) {
       return {};
     }
+    const types = [...new Set(groups.value.map(item => item.type))] as ShapeType[]
+    if (types.length > 1) {
+      if (!similars.some(similar => types.every(t => similar.includes(t)))) {
+        return
+      }
+    }
+
 
     const shareDescribes: Record<
       string,
       { desc: PropertyDescribes[string][]; data: { id: string }[] }
     > = {};
     const shareKeys: string[] = Object.keys(groups.value[0].desc);
-
     for (const item of groups.value) {
       const keys = Object.keys(item.desc);
       for (const key of keys) {

+ 5 - 0
src/core/hook/use-selection.ts

@@ -347,6 +347,11 @@ export const useSelectionRevise = () => {
   };
   const operMode = useOperMode();
   const layer = useFormalLayer();
+  watch(() => operMode.value.mulSelection, (muls, olv) => {
+    if (muls) {
+      status.selects = [...status.selects, ...status.actives]
+    }
+  }, {flush: 'pre'})
   watch(
     () => [!!ids.value.length, operMode.value.mulSelection],
     (_a, _b) => {

+ 7 - 2
src/example/fuse/enter.ts

@@ -90,8 +90,6 @@ const login = (isBack = true) => {
     });
     return;
   }
-
-  console.log(import.meta.env.VITE_LOGIN_VIEW);
   if (import.meta.env.VITE_LOGIN_VIEW) {
     const p: any = { ...params.value };
     delete p.token;
@@ -120,6 +118,13 @@ const login = (isBack = true) => {
 
 const after = async (fet: Promise<Response>) => {
   const res = await fet.then((res) => res.json());
+  if (res.code === 8034) {
+    setTimeout(() => {
+      history.back()
+    }, 1000)
+    throw `${res.message},即将退出`;
+  }
+
   if ([4008, 4010, 7012].includes(res.code)) {
     setTimeout(() => {
       window.platform.login(res.code !== 7012);