Browse Source

Merge branch 'dev' of http://124.70.149.18:10880/lianghj/queenshow into dev

lianghongjie 1 year ago
parent
commit
a05b63b52a
37 changed files with 264 additions and 149 deletions
  1. 23 10
      src/modules/editor/components/CompUI/basicUI/Text/component.tsx
  2. 13 10
      src/modules/editor/components/CompUI/basicUI/View.tsx
  3. 11 3
      src/modules/editor/components/CompUI/customUI/Cards/Card/index.tsx
  4. 1 1
      src/modules/editor/components/CompUI/customUI/Cards/Card11/component.tsx
  5. 6 8
      src/modules/editor/components/CompUI/customUI/Cards/Card11/index.ts
  6. 1 1
      src/modules/editor/components/CompUI/customUI/Cards/Card12/component.tsx
  7. 3 3
      src/modules/editor/components/CompUI/customUI/Cards/Card12/index.ts
  8. 2 2
      src/modules/editor/components/CompUI/customUI/Cards/Card13/component.tsx
  9. 1 2
      src/modules/editor/components/CompUI/customUI/Cards/Card13/index.ts
  10. 2 2
      src/modules/editor/components/CompUI/customUI/Cards/Card14/component.tsx
  11. 1 2
      src/modules/editor/components/CompUI/customUI/Cards/Card14/index.ts
  12. 5 5
      src/modules/editor/components/CompUI/customUI/Cards/Card15/component.tsx
  13. 8 3
      src/modules/editor/components/CompUI/customUI/Cards/Card15/index.ts
  14. 1 1
      src/modules/editor/components/CompUI/customUI/Cards/Card2/index.tsx
  15. 1 1
      src/modules/editor/components/CompUI/customUI/Cards/Card3/component.tsx
  16. 1 1
      src/modules/editor/components/CompUI/customUI/Cards/Card3/index.ts
  17. 1 1
      src/modules/editor/components/CompUI/customUI/Cards/Card5/component.tsx
  18. 9 3
      src/modules/editor/components/CompUI/customUI/Cards/Card5/index.ts
  19. 1 1
      src/modules/editor/components/CompUI/customUI/Cards/CardList/component.tsx
  20. 8 2
      src/modules/editor/components/CompUI/customUI/Cards/CardList/index.tsx
  21. 2 2
      src/modules/editor/components/CompUI/customUI/Covers/Cover/component.tsx
  22. 9 0
      src/modules/editor/components/CompUI/customUI/Covers/Cover/index.ts
  23. 15 0
      src/modules/editor/components/CompUI/customUI/Covers/Cover2/index.ts
  24. 1 0
      src/modules/editor/components/CompUI/customUI/Texts/Text1/component.tsx
  25. 13 4
      src/modules/editor/components/CompUI/customUI/Texts/Text1/index.ts
  26. 3 0
      src/modules/editor/components/CompUI/customUI/Titles/Title1/index.ts
  27. 2 3
      src/modules/editor/components/CompUI/customUI/Titles/Title2/index.ts
  28. 7 2
      src/modules/editor/components/CompUI/customUI/Titles/Title3/index.ts
  29. 2 2
      src/modules/editor/components/CompUI/customUI/index.ts
  30. 5 2
      src/modules/editor/controllers/HistoryCtrl/HistoryController.ts
  31. 2 1
      src/modules/editor/controllers/HistoryCtrl/index.ts
  32. 37 17
      src/modules/editor/controllers/SelectCtrl/ObjsContainer.ts
  33. 45 19
      src/modules/editor/controllers/SelectCtrl/index.ts
  34. 3 1
      src/modules/editor/module/actions/edit.ts
  35. 14 0
      src/modules/editor/module/actions/text.ts
  36. 2 1
      src/modules/editor/module/index.ts
  37. 3 33
      src/modules/editor/module/stores/index.ts

+ 23 - 10
src/modules/editor/components/CompUI/basicUI/Text/component.tsx

@@ -7,7 +7,7 @@ import { FontColor, FontFamily, FontSize } from "@ckeditor/ckeditor5-font";
 import { Link } from "@ckeditor/ckeditor5-link";
 import { Paragraph } from "@ckeditor/ckeditor5-paragraph";
 import { css } from "@linaria/core";
-import { defineComponent, watch, watchEffect } from "vue";
+import { defineComponent, ref, watch, watchEffect, reactive } from "vue";
 import { string } from "vue-types";
 import { useCompData } from ".";
 import { View } from "../View";
@@ -18,7 +18,7 @@ export const Component = defineComponent({
   },
   setup(props) {
     const comp = useCompData(props.compId);
-    const { store, helper, actions } = useEditor();
+    const { store, helper, actions, controls } = useEditor();
     const config = {
       language: "zh-cn",
       plugins: [
@@ -53,12 +53,24 @@ export const Component = defineComponent({
     };
 
     let editorInstance: InlineEditor;
+    let timeOut = ref();
+    const state = reactive({
+      textEditing: false,
+    });
 
     watchEffect(() => {
-      if (!store.textEditingState) {
+      if (!state.textEditing) {
         editorInstance?.setData(comp.value);
       }
     });
+    const toolbarClickListener = () => {
+      editorInstance.ui.view.toolbar.element?.addEventListener("click", () => {
+        if (timeOut.value) {
+          clearTimeout(timeOut.value);
+          timeOut.value = null;
+        }
+      });
+    };
 
     return () => (
       <View
@@ -69,19 +81,19 @@ export const Component = defineComponent({
           class={textStyle}
           editor={InlineEditor}
           onBlur={() => {
-            // actions.updateCompData(
-            //   helper.findComp(props.compId) as DesignComp,
-            //   "value",
-            //   editorInstance.getData()
-            // );
-            // store.setTextEditingState(false);
+            timeOut.value = setTimeout(() => {
+              state.textEditing = false;
+              store.setTextEditingState(false);
+              controls.historyCtrl.history.submit();
+            }, 500);
           }}
           onFocus={() => {
             store.setTextEditingState(true);
+            state.textEditing = true;
           }}
           onInput={(e: any) => {
             if (editorInstance) {
-              actions.updateCompData(
+              actions.setTextarea(
                 helper.findComp(props.compId) as DesignComp,
                 "value",
                 e
@@ -91,6 +103,7 @@ export const Component = defineComponent({
           onReady={(editor: InlineEditor) => {
             editorInstance = editor;
             editor.setData(comp.value);
+            toolbarClickListener();
             if (store.isPreview) {
               editor.enableReadOnlyMode("editor");
             }

+ 13 - 10
src/modules/editor/components/CompUI/basicUI/View.tsx

@@ -5,6 +5,7 @@ import { defineComponent } from "vue";
 import { string } from "vue-types";
 import { useEditor } from "../../..";
 import { useCompRef } from "./hooks";
+import { CompObject } from "@/modules/editor/controllers/SelectCtrl/compObj";
 
 export const View = defineComponent({
   props: {
@@ -20,6 +21,9 @@ export const View = defineComponent({
       if (!comp) return store.isEditMode ? <div>无效组件</div> : null;
       const isStreamCard = helper.isStreamCard(props.compId);
       const isGroupComp = helper.isGroupComp(props.compId);
+      const obj =new CompObject(store.compMap[props.compId])
+      const m = obj.worldTransform.clone();
+      m.invert();
 
       return (
         <div
@@ -39,17 +43,15 @@ export const View = defineComponent({
           onDblclick={() => emit("dblclick")}
         >
           <div
-            // onMousedown={(e) => {
-            //   if (helper.isGroupCompChild(props.compId)) return;
+            onMousedown={(e) => {
+              if (helper.isGroupCompChild(props.compId)) return;
+              e.stopPropagation();
+              
+              if (store.isEditMode) {
+                actions.pickComp(props.compId);
+              }
+            }}
 
-            //   // e.stopPropagation();
-            //   if (store.isEditMode) {
-            //     actions.pickComp(props.compId);
-            //     if (!helper.isStreamCard(props.compId)) {
-            //       controls.transferCtrl.mousedown(e, "move", store.currComp);
-            //     }
-            //   }
-            // }}
             onMousemove={(e) => {
               if (
                 !store.isEditMode ||
@@ -60,6 +62,7 @@ export const View = defineComponent({
               actions.pickComp(props.compId);
             }}
           >
+            
             {slots.default?.()}
           </div>
 

+ 11 - 3
src/modules/editor/components/CompUI/customUI/Cards/Card/index.tsx

@@ -16,10 +16,18 @@ export const { createComp, useCompData } = createCompHooks({
   value: {
     imgSize: [240, 240],
   },
+  layout: {
+    padding: "0.2rem 0.35rem",
+    size: [750, 500],
+  },
   children: {
-     img: ()=>createCompId("Image", {value: {url:thumb, x: 25.50, y: 7.00, s: 3.80}}),
-     desc: ()=>createCompId("Text", {value: `<p><span style="font-size:16px;">名称 &nbsp; p190 (注塑)</span></p><p><span style="font-size:16px;">规格 &nbsp; 52英寸</span></p><p><span style="font-size:16px;">厚度 &nbsp;1.0mm+0.05mm</span></p><p><span style="font-size:16px;">底材 &nbsp;鹿皮绒</span></p><p><span style="font-size:16px;">用途 &nbsp;凉鞋、跟鞋、高更鞋、</span><br><span style="font-size:16px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 时尚休闲鞋等</span></p>`})
-  }
+    img: () =>
+      createCompId("Image", { value: { url: thumb, x: 25.5, y: 7.0, s: 3.8 } }),
+    desc: () =>
+      createCompId("Text", {
+        value: `<p><span style="font-size:16px;">名称 &nbsp; p190 (注塑)</span></p><p><span style="font-size:16px;">规格 &nbsp; 52英寸</span></p><p><span style="font-size:16px;">厚度 &nbsp;1.0mm+0.05mm</span></p><p><span style="font-size:16px;">底材 &nbsp;鹿皮绒</span></p><p><span style="font-size:16px;">用途 &nbsp;凉鞋、跟鞋、高更鞋、</span><br><span style="font-size:16px;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 时尚休闲鞋等</span></p>`,
+      }),
+  },
 });
 
 export const Form = createAttrsForm([

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/Card11/component.tsx

@@ -27,7 +27,7 @@ export const Component = createUIComp({
 
     return () => {
       return (
-        <div class="flex">
+        <div class="flex px-0.35rem pt-0.3rem">
           <div class="flex-1 mx-0.3rem leading-loose relative z-10 w-0">
             <Text.Component compId={children.text} class="mt-0.2rem" />
             <div class="flex mt-0.2rem flex-wrap mr-0.8rem ml-0.2rem">

+ 6 - 8
src/modules/editor/components/CompUI/customUI/Cards/Card11/index.ts

@@ -12,8 +12,6 @@ export const options = {
 
 export const { createComp, useCompData, useCreateChild } = createCompHooks({
   layout: {
-    padding: "0.5rem 0",
-    // margin: "0.3rem 0.35rem",
     size: [750, 500],
   },
   value: {
@@ -33,8 +31,8 @@ export const { createComp, useCompData, useCreateChild } = createCompHooks({
           url: require("@/assets/comps/Card11/img_1.jpg"),
         },
         layout: {
-          size: [200, 400]
-        }
+          size: [251, 417],
+        },
       }),
     img2: () =>
       createCompId("Image", {
@@ -42,8 +40,8 @@ export const { createComp, useCompData, useCreateChild } = createCompHooks({
           url: require("@/assets/comps/Card11/img_shoe.png"),
         },
         layout: {
-          size: [200, 200]
-        }
+          size: [317, 240],
+        },
       }),
     list: (defaultOpts: any, length = 3) => {
       let i = 0;
@@ -54,8 +52,8 @@ export const { createComp, useCompData, useCreateChild } = createCompHooks({
             url: require(`@/assets/comps/Card11/cover_${i}.png`),
           },
           layout: {
-            size: [60, 60]
-          }
+            size: [72, 72],
+          },
         });
       });
     },

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/Card12/component.tsx

@@ -12,7 +12,7 @@ export const Component = createUIComp({
     const { children, value } = useCompData(props.compId);
 
     return () => (
-      <div class={cx("relative text-black overflow-hidden", rootStyles)}>
+      <div class={cx("relative pt-0.3rem text-black overflow-hidden", rootStyles)}>
         <div class="flex justify-end items-center relative mb-0.4rem">
           <div class="absolute right-0 top-1/2 h-3/2 w-5rem border-dark-300 border-1 border-solid border-r-0 border-b-0"></div>
           <Text.Component

+ 3 - 3
src/modules/editor/components/CompUI/customUI/Cards/Card12/index.ts

@@ -15,9 +15,7 @@ export const { createComp, useCompData } = createCompHooks({
     themeColor: "#5BA9CB",
   },
   layout: {
-    padding: "0.5rem 0",
-    // margin: "0.5rem 0.35rem",
-    size: [750, 500],
+    size: [750, 800],
   },
   children: {
     text: () =>
@@ -25,6 +23,7 @@ export const { createComp, useCompData } = createCompHooks({
         value: `<p><span style="font-size:20px;"><strong>P190-2#</strong></span></p>`,
         layout: {
           textAlign: "center",
+          size: [240, 60],
         },
       }),
     text2: () =>
@@ -32,6 +31,7 @@ export const { createComp, useCompData } = createCompHooks({
         value: `<p style="text-align:center;"><span style="color:hsl(0, 0%, 0%);">2#</span><br><span style="color:hsl(0, 0%, 0%);">克莱因蓝</span></p>`,
         layout: {
           textAlign: "center",
+          size: [124, 80],
         },
       }),
     img1: () =>

+ 2 - 2
src/modules/editor/components/CompUI/customUI/Cards/Card13/component.tsx

@@ -11,7 +11,7 @@ export const Component = createUIComp({
     const { children } = useCompData(props.compId);
 
     return () => (
-      <div class="relative flex text-black overflow-hidden">
+      <div class="relative flex px-0.35rem pt-0.4rem text-black overflow-hidden">
         <div class="ml-0.15rem mr-0.2rem">
           <Image.Component
             compId={children.img1}
@@ -21,7 +21,7 @@ export const Component = createUIComp({
         <div class="flex-1 mt-1rem py-0.58rem px-0.2rem mb-1.3rem border-2px border-black border-solid leading-loose">
           <Text.Component compId={children.text} />
         </div>
-        <div class="absolute bottom-0 left-0">
+        <div class="absolute bottom-0.1rem left-0.35rem">
           <Image.Component
             compId={children.imgShoe}
             class="w-3.5rem h-2.8rem object-cover"

+ 1 - 2
src/modules/editor/components/CompUI/customUI/Cards/Card13/index.ts

@@ -12,8 +12,7 @@ export const options = {
 export const { createComp, useCompData } = createCompHooks({
   value: {},
   layout: {
-    padding: "0 0.35rem",
-    size: [750, 500],
+    size: [750, 800],
   },
   children: {
     text: () =>

+ 2 - 2
src/modules/editor/components/CompUI/customUI/Cards/Card14/component.tsx

@@ -11,8 +11,8 @@ export const Component = createUIComp({
     const { children } = useCompData(props.compId);
 
     return () => (
-      <div class="">
-        <div class="flex justify-end relative pb-0.22rem z-10">
+      <div class="pt-0.2rem px-0.35rem">
+        <div class="flex justify-end relative pb-0.22rem  z-10">
           <div class="absolute left-0 bottom-0 z-10">
             <Image.Component
               compId={children.imgShoe}

+ 1 - 2
src/modules/editor/components/CompUI/customUI/Cards/Card14/index.ts

@@ -12,8 +12,7 @@ export const options = {
 export const { createComp, useCompData } = createCompHooks({
   value: {},
   layout: {
-    padding: "0 0.35rem",
-    size: [750, 500],
+    size: [750, 750],
   },
   children: {
     text: () =>

+ 5 - 5
src/modules/editor/components/CompUI/customUI/Cards/Card15/component.tsx

@@ -12,7 +12,7 @@ export const Component = createUIComp({
     const { children, value } = useCompData(props.compId);
 
     return () => (
-      <div class={cx(rootStyles, "text-black")}>
+      <div class={cx(rootStyles, "pl-0.65rem pr-0.35rem pt-0.3rem text-black")}>
         <div class="relative mb-0.4rem flex items-center justify-start">
           <Text.Component
             compId={children.title}
@@ -21,7 +21,7 @@ export const Component = createUIComp({
           <div class="absolute left-0 top-1/2 w-5.1rem h-3/2 border-solid border-dark-200 border-1 border-b-0 border-l-0"></div>
         </div>
         <div
-          class="relative pl-0.28rem"
+          class="relative"
           style={{
             backgroundImage: `linear-gradient(${value.themeColor} 87%, #fff 87%)`,
           }}
@@ -43,14 +43,14 @@ export const Component = createUIComp({
             compId={children.img1}
             class="-ml-0.28rem w-6.22rem h-6.22rem object-cover"
           />
-          <div class="relative flex justify-end mt-0.5rem pb-0.35rem -ml-0.28rem">
+          <div class="relative flex justify-end mt-0.5rem pb-0.35rem">
             <Text.Component
               compId={children.text}
-              class="w-4.75rem py-0.55rem bg-light-50 border-dark-200 border-2 border-solid leading-loose"
+              class="w-4.75rem py-0.3rem bg-light-50 border-dark-200 border-2 border-solid leading-loose"
             />
             <Image.Component
               compId={children.img2}
-              class="!absolute bottom-0 left-0 w-4rem h-2.85rem object-cover"
+              class="!absolute bottom-0 left-0 -ml-0.28rem w-4rem h-2.85rem object-cover"
             />
           </div>
         </div>

+ 8 - 3
src/modules/editor/components/CompUI/customUI/Cards/Card15/index.ts

@@ -15,24 +15,29 @@ export const { createComp, useCompData } = createCompHooks({
     themeColor: "#6D8D70",
   },
   layout: {
-    padding: "0 0.35rem",
-    size: [750, 500],
+    size: [750, 1200],
   },
   children: {
     title: () =>
       createCompId("Text", {
         value:
           '<p><span style="font-size:24px;"><strong>P190-3#</strong></span></p>',
+        layout: {
+          size: [260, 60],
+        },
       }),
     colorText: () =>
       createCompId("Text", {
         value: `<p style="text-align:center;"><span style="color:hsl(0, 0%, 0%);font-size:12px;">3#&nbsp;</span></p><p style="text-align:center;"><span style="color:hsl(0, 0%, 0%);font-size:12px;">铜绿色</span></p>`,
+        layout: {
+          size: [130, 80],
+        },
       }),
     text: () =>
       createCompId("Text", {
         value: `<p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">绿色是个舒服的颜色,&nbsp;</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">处处充满着生机和希望,</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">&nbsp;其明净空旷往往让人迷失其中,</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">&nbsp;给人无限的对未来的憧憬,</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,0%);font-size:12px;">&nbsp;不需要过多的言语,让心灵感到平和</span></p>`,
         layout: {
-          textAlign: "center",
+          size: [475, 328],
         },
       }),
     img2: () =>

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/Card2/index.tsx

@@ -17,7 +17,7 @@ export const { createComp, useCompData } = createCompHooks({
   value: {},
   layout: {
     padding: "0 0 0.2rem 0",
-    size: [750, 500],
+    size: [750, 600],
   },
   children: {
     bgImg: () =>

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/Card3/component.tsx

@@ -13,7 +13,7 @@ export const Component = createUIComp({
     const { children } = useCompData(props.compId);
 
     return () => (
-      <div class="flex justify-between">
+      <div class="relative flex justify-between">
         <div class="flex flex-col justify-center">
           <Text.Component compId={children.text1} />
           <Text.Component class="mt-0.07rem" compId={children.text2} />

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/Card3/index.ts

@@ -17,7 +17,7 @@ export const { createComp, useCompData } = createCompHooks({
   value: {},
   layout: {
     padding: "0.2rem",
-    size: [750, 600],
+    size: [750, 300],
   },
   children: {
     bgImg: () =>

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/Card5/component.tsx

@@ -15,7 +15,7 @@ export const Component = createUIComp({
     return () => (
       <div class="relative w-full">
         <div class="!absolute w-full h-full flex justify-center items-center">
-          <Text.Component class="!absolute w-full" compId={children.text1} />
+          <Text.Component class="!absolute w-full tracking-5px" compId={children.text1} />
         </div>
         <div class="flex justify-center">
           <Image.Component

+ 9 - 3
src/modules/editor/components/CompUI/customUI/Cards/Card5/index.ts

@@ -16,18 +16,24 @@ export const options = {
 export const { createComp, useCompData } = createCompHooks({
   value: {},
   layout: {
-    size: [750, 500]
+    size: [750, 275],
   },
   children: {
     bgImg: () =>
       createCompId("Image", {
         value: {
-          url: "https://sku3d-test.obs.cn-east-3.myhuaweicloud.com/queenshow/1685609522134_nGPo9k_2.png",
+          url: require("@/assets/comps/Card14/img_shoe.png"),
+        },
+        layout: {
+          size: [750, 275],
         },
       }),
     text1: () =>
       createCompId("Text", {
-        value: `<p style="text-align:center;"><span style="color:hsl(0,0%,90%);font-size:52px;">F A SH I O N</span></p>`,
+        value: `<p style="text-align:center;"><span style="color:hsl(0,0%,90%);font-size:60px;">FASHION</span></p>`,
+        layout: {
+          size: [750, 275],
+        },
       }),
   },
 });

+ 1 - 1
src/modules/editor/components/CompUI/customUI/Cards/CardList/component.tsx

@@ -29,7 +29,7 @@ export const Component = createUIComp({
 
     return () => (
       <div
-        class="grid"
+        class="grid px-0.2rem pt-0.3rem"
         style={{
           gridTemplateColumns: `repeat(${value.columns}, 1fr)`,
           gridGap: helper.designToNaturalSize(value.gap),

+ 8 - 2
src/modules/editor/components/CompUI/customUI/Cards/CardList/index.tsx

@@ -12,6 +12,9 @@ export const options = {
 };
 
 export const { createComp, useCompData, useCreateChild } = createCompHooks({
+  layout: {
+    size: [750, 420],
+  },
   value: {
     gap: 10,
     columns: 3,
@@ -40,11 +43,14 @@ export const { createComp, useCompData, useCreateChild } = createCompHooks({
               ...offset,
             },
             layout: {
-              size: [0, 0]
-            }
+              size: [230, 300],
+            },
           }),
           desc: createCompId("Text", {
             value: `<p style="text-align:center;">这是一个小标题</p>`,
+            layout: {
+              size: [230, 40],
+            },
           }),
         };
       });

+ 2 - 2
src/modules/editor/components/CompUI/customUI/Covers/Cover/component.tsx

@@ -38,8 +38,8 @@ const titleCls = css`
   position: absolute;
   left: 50%;
   top: 20%;
-  width: 7rem;
-  transform: translateX(-50%);
+  /* width: 7rem; */
+  transform: translateX(-50%) !important;
 `;
 
 const arrowCls = css`

+ 9 - 0
src/modules/editor/components/CompUI/customUI/Covers/Cover/index.ts

@@ -10,6 +10,9 @@ export const options = {
 };
 
 export const { createComp, useCompData } = createCompHooks({
+  layout: {
+    size: [750, 1300],
+  },
   value: {},
   children: {
     bg: () =>
@@ -17,10 +20,16 @@ export const { createComp, useCompData } = createCompHooks({
         value: {
           url: "https://infishwaibao.oss-cn-chengdu.aliyuncs.com/release/sku3d/img/partner_bg.5e324d05.png",
         },
+        layout: {
+          size: [750, 1300],
+        },
       }),
     title: () =>
       createCompId("Text", {
         value: `<p style="text-align:center;"><span style="color:hsl(0,0%,100%);font-size:28px;">新科技反光面料</span></p><p style="text-align:center;"><span style="color:hsl(0,0%,100%);font-size:28px;">引领潮流新风尚</span></p><p style="text-align:center;">&nbsp;</p><p style="text-align:center;"><span style="color:hsl(0,0%,100%);font-size:16px;">时尚 | 精致 | 百搭</span></p>`,
+        layout: {
+          size: [750, 200],
+        },
       }),
   },
 });

+ 15 - 0
src/modules/editor/components/CompUI/customUI/Covers/Cover2/index.ts

@@ -11,6 +11,9 @@ export const options = {
 
 export const { createComp, useCompData } = createCompHooks({
   value: {},
+  layout: {
+    size: [750, 500],
+  },
   children: {
     img1: () =>
       createCompId("Image", {
@@ -20,22 +23,34 @@ export const { createComp, useCompData } = createCompHooks({
           y: 0,
           s: 1,
         },
+        layout: {
+          size: [451, 1022],
+        },
       }),
     img2: () =>
       createCompId("Image", {
         value: {
           url: require("@/assets/comps/Cover2/img_2.jpg"),
         },
+        layout: {
+          size: [167, 306],
+        },
       }),
     img3: () =>
       createCompId("Image", {
         value: {
           url: require("@/assets/comps/Cover2/img_3.jpg"),
         },
+        layout: {
+          size: [167, 208],
+        },
       }),
     title: () =>
       createCompId("Text", {
         value: `<p style="text-align:center;"><span style="color:hsl(0,0%,60%);font-size:42px;">NEW &nbsp;</span><span style="font-size:42px;"> FasHION</span></p><p>&nbsp;</p>`,
+        layout: {
+          size: [750, 110],
+        },
       }),
     text1: () =>
       createCompId("Text", {

+ 1 - 0
src/modules/editor/components/CompUI/customUI/Texts/Text1/component.tsx

@@ -58,6 +58,7 @@ export const Component = createUIComp({
 });
 
 const rootStyles = css`
+  padding: 0 0.2rem;
   .text {
     &::before {
       content: "";

+ 13 - 4
src/modules/editor/components/CompUI/customUI/Texts/Text1/index.ts

@@ -35,8 +35,7 @@ export const options = {
 
 export const { createComp, useCompData, useCreateChild } = createCompHooks({
   layout: {
-    padding: " 0 0.2rem",
-    size: [750, 100]
+    size: [750, 420],
   },
   value: {
     columns: 5,
@@ -50,8 +49,18 @@ export const { createComp, useCompData, useCreateChild } = createCompHooks({
       return Array.from({ length }, () => {
         i = i + 1;
         return {
-          label: createCompId("Text", { value: defaultData[i]?.label }),
-          content: createCompId("Text", { value: defaultData[i]?.content }),
+          label: createCompId("Text", {
+            value: defaultData[i]?.label,
+            layout: {
+              size: [160, 60],
+            },
+          }),
+          content: createCompId("Text", {
+            value: defaultData[i]?.content,
+            layout: {
+              size: [160, 60],
+            },
+          }),
         };
       });
     },

+ 3 - 0
src/modules/editor/components/CompUI/customUI/Titles/Title1/index.ts

@@ -12,6 +12,9 @@ export const options = {
 };
 
 export const { createComp, useCompData } = createCompHooks({
+  layout: {
+    size: [750, 180],
+  },
   value: {
     themeColor: "#666666",
   },

+ 2 - 3
src/modules/editor/components/CompUI/customUI/Titles/Title2/index.ts

@@ -12,15 +12,14 @@ export const options = {
 export const { createComp, useCompData } = createCompHooks({
   value: {},
   layout: {
-    padding: "0.5rem 0",
-    size: [750, 300]
+    size: [750, 80],
   },
   children: {
     title: () =>
       createCompId("Text", {
         value: `<p style="text-align:center;"><span style="color:#333;font-size:20px;font-weight: bold;">产品信息</span></p>`,
         layout: {
-          textAlign: "center",
+          size: [300, 60],
         },
       }),
   },

+ 7 - 2
src/modules/editor/components/CompUI/customUI/Titles/Title3/index.ts

@@ -15,17 +15,22 @@ export const options = {
 export const { createComp, useCompData } = createCompHooks({
   value: {},
   layout: {
-    padding: "0.2rem",
-    size: [750,300]
+    size: [750, 130],
   },
   children: {
     title: () =>
       createCompId("Text", {
         value: `<p style="text-align:center;"><span style="color:#333;font-size:20px;font-weight: bold;">产品详情</span></p>`,
+        layout: {
+          size: [750, 70],
+        },
       }),
     subtitle: () =>
       createCompId("Text", {
         value: `<p style="text-align:center;">/ Product Details /</p>`,
+        layout: {
+          size: [750, 60],
+        },
       }),
   },
 });

+ 2 - 2
src/modules/editor/components/CompUI/customUI/index.ts

@@ -1,8 +1,8 @@
-export * as Card from "./Cards/Card";
+// export * as Card from "./Cards/Card";
 export * as Card2 from "./Cards/Card2";
 export * as Card3 from "./Cards/Card3";
 export * as CardList from "./Cards/CardList";
-export * as Card4 from "./Cards/Card4";
+// export * as Card4 from "./Cards/Card4";
 export * as Card5 from "./Cards/Card5";
 export * as Cards11 from "./Cards/Card11";
 export * as Cards12 from "./Cards/Card12";

+ 5 - 2
src/modules/editor/controllers/HistoryCtrl/HistoryController.ts

@@ -22,8 +22,8 @@ export class HistoryController {
   cacheGroupAction = new GroupAction();
 
   // 添加缓存记录
-  record(action: Action) {
-    this.cacheGroupAction.record(action);
+  record(action: Action, options?: RecordOptions) {
+    this.cacheGroupAction.record(action, options);
   }
 
   // 保存缓存记录到历史栈中
@@ -45,16 +45,19 @@ export class HistoryController {
     state.currLen = queue.length;
     // 更新当前缓存GroupAction
     this.cacheGroupAction = new GroupAction();
+    console.log(this);
   }
 
   undo() {
     if (!this.state.canUndo) return;
     this.queue[this.state.opIndex--].undo();
+    console.log(this)
   }
 
   redo() {
     if (!this.state.canRedo) return;
     this.queue[++this.state.opIndex].redo();
+    console.log(this)
   }
 
   //清除操作

+ 2 - 1
src/modules/editor/controllers/HistoryCtrl/index.ts

@@ -5,6 +5,7 @@ import { Action, HistoryController } from "./HistoryController";
 export class HistoryCtrl {
   history: HistoryController;
   historyActionDoing = false;
+  historyCombine = false;
 
   constructor(protected module: EditorModule, historyTotal = 50) {
     this.history = new HistoryController();
@@ -20,7 +21,7 @@ export class HistoryCtrl {
   ) {
     if (this.historyActionDoing) {
       const action = new Action(type, root, paths.join("."), value, oldValue);
-      this.history.record(action);
+      this.history.record(action, {combine: this.historyCombine});
     }
   }
 

+ 37 - 17
src/modules/editor/controllers/SelectCtrl/ObjsContainer.ts

@@ -2,6 +2,7 @@ import { Bounds } from './objects/bounds';
 import { Rectangle } from './objects/rectangle';
 import { Container } from './objects/container';
 import { CompObject } from './compObj';
+import { Matrix } from './matrix';
 
 export class ObjsContainer {
     aabb = new Bounds();
@@ -216,38 +217,57 @@ export class ObjsContainer {
 
     scaleX(x:number) {
         this.parent.scale.x = x;
-
         this.parent.updateTransform();
         this.updateCompState();
     }
 
     scaleY(y:number) {
         this.parent.scale.y = y;
-
         this.parent.updateTransform();
-
-       
         this.updateCompState();
     }
 
-    //清除当前元素的缩放 改为类容的宽度
-    applyScaleToChildSize() {
-        if (this.selected.length  != 1 ) return;
-       
-        const w = this.width *this.parent.scale.x;
-        const h = this.height  *this.parent.scale.y;
-        this.parent.scale.x = 1;
-        this.parent.scale.y = 1;
+    applyChildWidth(option:{Width?:number, Height?:number}) {
+        const obj = this.selected[0];
+        //先移除
+        this.parent.removeChildWorldNoChange(obj);
+        const m = new Matrix();
+        m.scale(option.Width ? option.Width/obj.width :1 , option.Height? option.Height / obj.height: 1)
+        m.invert();
+        m.prepend(obj.worldTransform)
+        obj.transform.setFromMatrix(m)
+        if (option.Width) {
+            obj.width = option.Width
+        }
+        if (option.Height) {
+            obj.height = option.Height
+        }
+        obj.updateTransform();
+        this.parent.addChildWorldNoChange(obj);
+    }
+    scaleSize(Width:number, Height:number) {
+        this.parent.scale.y = Height / this.rect.height
+        this.parent.scale.x = Width / this.rect.width
         this.parent.updateTransform();
+        this.applyChildWidth({Width, Height})
+        this.updateCompState();
+    }
 
-        this.rect.width = w;
-        this.rect.height = h;
-        this.selected[0].width = w;
-        this.selected[0].height = h;
-
+    scaleWidth(Width:number) {
+        //怎么改对应的偏移值
+        this.parent.scale.x = Width / this.rect.width
+        this.parent.updateTransform();
+        this.applyChildWidth({Width})
         this.updateCompState();
     }
 
+    scaleHeight(Height:number) {
+        this.parent.scale.y = Height / this.rect.height
+        this.parent.updateTransform();
+        this.applyChildWidth({Height});
+        this.updateCompState();
+    }
+    
     translate(x:number, y:number) {
         this.parent.x += x;
         this.parent.y += y;

+ 45 - 19
src/modules/editor/controllers/SelectCtrl/index.ts

@@ -59,9 +59,13 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
   _downClientY = 0;
   //groupCtrl = new GroupActionCtrl(this.module);
   bus = new Event();
-  viewport?:HTMLElement;
+  viewport?: HTMLElement;
 
-  initEvents(pageEl: HTMLElement, selCanvas: HTMLCanvasElement, viewport:HTMLElement) {
+  initEvents(
+    pageEl: HTMLElement,
+    selCanvas: HTMLCanvasElement,
+    viewport: HTMLElement
+  ) {
     this.viewport = viewport;
     this.pageEl = pageEl;
     this.selCanvas = selCanvas;
@@ -74,7 +78,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
     this._selCanvaseSize.w = selCanvas.width * 2;
     this._selCanvaseSize.h = selCanvas.height * 2;
 
-    document.addEventListener("mousedown", this.onDocMouseDown.bind(this));
+    document.addEventListener("mousedown", this.onDocMouseDown.bind(this), {capture: true});
     document.addEventListener("mousemove", this.onDocMouseMove.bind(this));
     document.addEventListener("mouseup", this.onDocMouseUp.bind(this));
 
@@ -85,6 +89,9 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
   onDocMouseDown(e: MouseEvent) {
     if (!this.pageEl || !this.selCanvas) return;
 
+    if (this.store.textEditingState) {
+        return
+    }
     let box = this.pageEl.getBoundingClientRect();
     const pageX = e.clientX - box?.left;
     const pageY = e.clientY - box?.top;
@@ -122,13 +129,17 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
         //判断是否有点击到card stream
         const comps = this.compClickTest(e);
         this.mouseDownSelects = comps;
-        console.log("comps=>", comps);
+        console.log("comps=>", comps);       
         if (comps.length < 1) {
-            const view =  this.viewport?.getBoundingClientRect() as any;
-            const isOut = (e.clientX < view.left || e.clientX > (view.right) || e.clientY < view.top || e.clientY > view.bottom)
-            if (!isOut) {
-                this._state = MODE_SEL_RECT;
-            }
+          const view = this.viewport?.getBoundingClientRect() as any;
+          const isOut =
+            e.clientX < view.left ||
+            e.clientX > view.right ||
+            e.clientY < view.top ||
+            e.clientY > view.bottom;
+          if (!isOut) {
+            this._state = MODE_SEL_RECT;
+          }
         } else {
           this._state = MODE_MOVING;
           const obj = this.compMap[comps[0].id];
@@ -247,7 +258,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
     }
   }
 
-  translate(xOffset:number, yOffset:number) {
+  translate(xOffset: number, yOffset: number) {
     const objContainer = this.objContainer as ObjsContainer;
     objContainer.translate(xOffset, yOffset);
     this.upgateGizmoStyle();
@@ -301,7 +312,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
     let isClick = false;
     const dx = Math.abs(e.clientX - this._downClientX);
     const dy = Math.abs(e.clientY - this._downClientY);
-    if (dx < 2 && dy < 2) {
+    if (dx < 2 && dy < 2 && !this.store.textEditingState ) {
       isClick = true;
     }
     if (isClick) {
@@ -385,7 +396,6 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
 
     let tmp = new Matrix();
     tmp.copyFrom(obj.worldTransform);
-    // tmp.scale(0.5 , 0.5);
 
     let matrix = `matrix(${tmp.a},${tmp.b},${tmp.c},${tmp.d},${tmp.tx},${tmp.ty})`;
     tmp.invert();
@@ -469,7 +479,7 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       return;
 
     if (objs.length == 1) {
-        this.actions.pickComp(objs[0].comp.id);
+      this.actions.pickComp(objs[0].comp.id);
     }
 
     // objs = this.getSceneObjOrderArr(objs);
@@ -656,6 +666,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
   scaleCmd = false;
   lastScale = { x: 1, y: 1 };
 
+  initScaleWith = {w: 0, h:0};
+
   scaleMousemove(event: MouseEvent) {
     let dirIndexs = [
       "scaleBottomright",
@@ -687,6 +699,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       this.mainAxisVector = { x: StartX - pivot.x, y: StartY - pivot.y };
       let scale = objContainer.parent.scale;
       this.initScale = { x: scale.x, y: scale.y };
+      this.initScaleWith = {w: objContainer.width, h: objContainer.height}
+
       this.mainAxisVectorLenth = VectorLenth(
         this.mainAxisVector.x,
         this.mainAxisVector.y
@@ -712,7 +726,10 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       let dtaY = Project(vec, this.yAxisVector) / this.yAxisVectorLength;
       this.lastScale.x = dtaX * this.initScale.x;
       this.lastScale.y = dtaY * this.initScale.y;
-      objContainer.scale(this.lastScale.x, this.lastScale.y);
+    //   objContainer.scale(this.lastScale.x, this.lastScale.y);
+        const currW = this.initScaleWith.w * this.lastScale.x;
+        objContainer.scaleSize(currW, this.lastScale.y * this.initScaleWith.h);
+
     } else {
       let mainVec = this.mainAxisVector;
       let dtaScale = Project(vec, mainVec) / this.mainAxisVectorLenth;
@@ -721,13 +738,22 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       if (i == -1) {
         this.lastScale.x = dtaScale * this.initScale.x;
         this.lastScale.y = dtaScale * this.initScale.y;
-        objContainer.scale(this.lastScale.x, this.lastScale.y);
+        // objContainer.scale(this.lastScale.x, this.lastScale.y);
+        const currW = this.initScaleWith.w * this.lastScale.x;
+        objContainer.scaleSize(currW, this.initScaleWith.h *this.lastScale.y);
+        // objContainer.scaleHeight(, dtaScale);
+
       } else if (i == 0 || i == 1) {
         this.lastScale.x = dtaScale * this.initScale.x;
-        objContainer.scaleX(this.lastScale.x);
+        // objContainer.scaleX(this.lastScale.x);
+        const currW = this.initScaleWith.w * this.lastScale.x;
+        objContainer.scaleWidth(currW);
+
       } else if (i == 2 || i == 3) {
         this.lastScale.y = dtaScale * this.initScale.y;
-        objContainer.scaleY(this.lastScale.y);
+        
+        // objContainer.scaleY(this.lastScale.y);
+        objContainer.scaleHeight(this.lastScale.y * this.initScaleWith.h);
       }
     }
 
@@ -740,8 +766,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
       let preScale = { x: this.initScale.x, y: this.initScale.y };
       let scaleIndex = this.scaleIndex;
       let lastScale = { x: this.lastScale.x, y: this.lastScale.y };
-      this.objContainer?.applyScaleToChildSize();
-      this.upgateGizmoStyle();
+    //   this.objContainer?.applyScaleToChildSize();
+    //   this.upgateGizmoStyle();
       // this.editor.history.record({
       //     undo:()=>{
       //         this.objContainer.setPivot( scaleIndex );

+ 3 - 1
src/modules/editor/module/actions/edit.ts

@@ -109,8 +109,10 @@ export const editActions = EditorModule.action({
   },
   // 删除组件
   removeComp(compId: string) {
+
     if (this.helper.isCompCanDelete(compId)) {
       if (compId === this.store.currCompId) {
+        this.controls.selectCtrl.selecteObjs([]);
         this.store.setCurrComp("root");
       }
       this.store.deleteComp(compId);
@@ -237,7 +239,7 @@ export const editActions = EditorModule.action({
   // 设置组件变换
   setCompTransformMatrix(comp: DesignComp, transformMatrix: string) {
     if (!comp) return;
-    
+
     comp.layout.transformMatrix = transformMatrix;
   },
 

+ 14 - 0
src/modules/editor/module/actions/text.ts

@@ -0,0 +1,14 @@
+import { set } from "lodash";
+import { EditorModule } from "..";
+import { DesignComp } from "../../objects/DesignTemp/DesignComp";
+
+export const textActions = EditorModule.action({
+  setTextarea(comp: DesignComp, path: string, value: any) {
+    const { historyCtrl } = this.controls;
+    historyCtrl.historyActionDoing = true;
+    historyCtrl.historyCombine = true;
+    set(comp, path, value);
+    historyCtrl.historyCombine = false;
+    historyCtrl.historyActionDoing = false;
+  },
+});

+ 2 - 1
src/modules/editor/module/index.ts

@@ -16,6 +16,7 @@ import { store } from "./stores";
 import { DragAddCtrl } from "../controllers/DragAddCtrl";
 import { SelectCtrl } from "../controllers/SelectCtrl";
 import { CompObject } from "../controllers/SelectCtrl/compObj";
+import { textActions } from "./actions/text";
 
 export class EditorModule extends ModuleRoot {
   config = this.setConfig({
@@ -25,7 +26,7 @@ export class EditorModule extends ModuleRoot {
   });
   components = this.useComponents(components);
 
-  actions = this.createActions([initActions, editActions, ImgCompActions]);
+  actions = this.createActions([initActions, editActions, ImgCompActions, textActions]);
   https = this.createHttps(https);
   store = this.createStore(store, {
     transform: (state) => createProxy(state),

+ 3 - 33
src/modules/editor/module/stores/index.ts

@@ -31,7 +31,7 @@ export const store = EditorModule.store({
     compMap(state) {
       return state.designData.compMap;
     },
-    
+
     currComp(state) {
       return state.designData.compMap[state.currCompId];
     },
@@ -85,39 +85,9 @@ export const store = EditorModule.store({
      
       this.store.currCompId = compId;
 
-      const find = (objs: string[], id: string): boolean => {
-        if (!objs || objs.length < 1) return false;
-
-        if (objs.includes(id)) return true;
+      const comps = this.helper.getCompTrees(compId);
 
-        let n = objs.length;
-        let f = false;
-        while (n--) {
-          f = find(
-            this.store.designData.compMap[objs[n]].children.default as any,
-            id
-          );
-          if (f) {
-            break;
-          }
-        }
-        return f;
-      };
-      const ids = this.store.streamCardIds;
-      if (ids.indexOf(compId) > -1) {
-        this.store.currStreamCardId = compId;
-      }
-      let i = ids.length;
-      while (i--) {
-        const isFind = find(
-          this.store.designData.compMap[ids[i]].children.default as any,
-          compId
-        );
-        if (isFind) {
-          this.store.currStreamCardId = ids[i];
-          break;
-        }
-      }
+      this.store.currStreamCardId = comps[1]?.id || ''
     },
 
     deleteComp(compId: string) {