bill 2 months ago
parent
commit
2f9ad655b7

+ 0 - 2
src/core/components/group/group.vue

@@ -83,7 +83,6 @@ const { shape, tData, data } = useComponentStatus<Rect, GroupData>({
       }, 6),
       start() {
         autoUpdate.value = false;
-        console.error("开始批量移动");
         history.onceTrack(
           () =>
             new Promise<void>((resolve) => {
@@ -94,7 +93,6 @@ const { shape, tData, data } = useComponentStatus<Rect, GroupData>({
       callback() {
         autoUpdate.value = true;
         transformResolve();
-        console.log("结束批量移动");
         callback();
       },
     });

+ 7 - 7
src/core/components/image/temp-image.vue

@@ -41,17 +41,17 @@ watch(
   { immediate: true }
 );
 
-const size = useViewSize();
+// const size = useViewSize();
 const config = computed(() => {
   let w = data.value.width;
   let h = data.value.height;
   // 认为是百分比
-  if (image.value && size.value && (w <= 1 || h <= 1)) {
-    w = w <= 1 ? size.value.width * w : w;
-    h = h <= 1 ? size.value.height * h : h;
-    w = w || (image.value.width / image.value.height) * h;
-    h = h || (image.value.height / image.value.width) * w;
-  }
+  // if (image.value && size.value && (w <= 1 || h <= 1)) {
+  //   w = w <= 1 ? size.value.width * w : w;
+  //   h = h <= 1 ? size.value.height * h : h;
+  //   w = w || (image.value.width / image.value.height) * h;
+  //   h = h || (image.value.height / image.value.width) * w;
+  // }
   w = w || image.value?.width || 0;
   h = h || image.value?.height || 0;
 

+ 10 - 5
src/core/hook/use-global-vars.ts

@@ -260,20 +260,26 @@ export const usePointerIntersection = installGlobalVar(() => {
 export const useDownKeys = installGlobalVar(() => {
   const keyKeys = reactive(new Set<string>());
   const mouseKeys = reactive(new Set<string>());
+  const evHandler = (ev: KeyboardEvent | MouseEvent, keys: Set<string>) => {
+      ev.shiftKey ? keys.add("Shift") : keys.delete("Shift");
+      ev.altKey ? keys.add("Alt") : keys.delete("Alt");
+      ev.metaKey ? keys.add("Meta") : keys.delete("Meta");
+      ev.ctrlKey ? keys.add("Ctrl") : keys.delete("Ctrl");
+
+  }
   const cleanup = mergeFuns(
     listener(window, "keydown", (ev) => {
       if (ev.target === document.body) {
         keyKeys.add(ev.key);
+        evHandler(ev, keyKeys)
       }
     }),
     listener(window, "keyup", (ev) => {
       keyKeys.delete(ev.key);
+      evHandler(ev, keyKeys)
     }),
     listener(window, "mousemove", (ev) => {
-      ev.shiftKey ? mouseKeys.add("Shift") : mouseKeys.delete("Shift");
-      ev.altKey ? mouseKeys.add("Alt") : mouseKeys.delete("Alt");
-      ev.metaKey ? mouseKeys.add("Meta") : mouseKeys.delete("Meta");
-      ev.ctrlKey ? mouseKeys.add("Ctrl") : mouseKeys.delete("Ctrl");
+      evHandler(ev, mouseKeys)
     })
   );
   const keys = reactive(new Set<string>());
@@ -286,7 +292,6 @@ export const useDownKeys = installGlobalVar(() => {
       keys.add(key);
     }
   });
-
   return {
     var: keys,
     onDestroy: cleanup,