bill 2 ماه پیش
والد
کامیت
14af60a5f9
3فایلهای تغییر یافته به همراه10 افزوده شده و 5 حذف شده
  1. 3 3
      public/icons/Elevator.svg
  2. 5 0
      src/core/components/icon/temp-icon.vue
  3. 2 2
      src/example/constant.ts

+ 3 - 3
public/icons/Elevator.svg

@@ -1,8 +1,8 @@
 <svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg">
 <path d="M2.5 29.5H10.5V27.5H4.5V4.5H27.5V27.5H20.5V29.5H29.5V2.5H2.5V29.5Z" stroke="black" stroke-linecap="square"/>
-<path d="M11 28.5H20" stroke="black" stroke-linecap="square"/>
+<path d="M10.5 28.5H20.5" stroke="black" stroke-linecap="square"/>
 <path d="M8.5 9.5V7.5H23.5V9.5H8.5Z" stroke="black" stroke-linecap="square"/>
 <path d="M24.5 12.5H7.5V24.5H24.5V12.5Z" stroke="black" stroke-linecap="square"/>
-<path d="M8 13L24 24" stroke="black" stroke-linecap="square"/>
-<path d="M24 13L8 24" stroke="black" stroke-linecap="square"/>
+<path d="M7.5 12.5L24.5 24.5" stroke="black"/>
+<path d="M24.5 12.5L7.5 24.5" stroke="black"/>
 </svg>

+ 5 - 0
src/core/components/icon/temp-icon.vue

@@ -16,6 +16,8 @@ import { DC } from "@/deconstruction.js";
 import { Transform } from "konva/lib/Util";
 import { useViewerInvertTransform, useViewSize } from "@/core/hook/use-viewer.ts";
 import { getFixPosition } from "@/utils/bound.ts";
+import { useStore } from "@/core/store/index.ts";
+import { useHistory } from "@/core/hook/use-history.ts";
 
 const props = defineProps<{ data: IconData; addMode?: boolean }>();
 const svg = ref<SVGParseResult | null>(null);
@@ -28,6 +30,8 @@ defineExpose({
   },
 });
 
+const store = useStore();
+const history = useHistory();
 watch(
   () => data.value.url,
   async (url) => {
@@ -38,6 +42,7 @@ watch(
     if (content.paths.length === 0) {
       svg.value = null;
       console.error(props.data.url, content, "路径数据不正确不是svg");
+      history.preventTrack(() => store.delItem("icon", props.data.id));
     } else {
       svg.value = content;
     }

+ 2 - 2
src/example/constant.ts

@@ -20,8 +20,8 @@ export const iconGroups: IconGroup[] = [
       {
         name: "门",
         children: [
-          { wall: true, icon: "men_l", name: "门" },
-          { wall: true, icon: "men", name: "门" },
+          { wall: true, icon: "men_l", name: "左开门" },
+          { wall: true, icon: "men", name: "右开门" },
           { wall: true, icon: "shuangkaimen", name: "双开门" },
           { wall: true, icon: "yimen", name: "移门" },
           { wall: true, icon: "yakou", name: "哑口" },