Procházet zdrojové kódy

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

qinyan před 1 rokem
rodič
revize
af02676a89

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

@@ -43,14 +43,14 @@ export const View = defineComponent({
           onDblclick={() => emit("dblclick")}
         >
           <div
-            onMousedown={(e) => {
-              if (helper.isGroupCompChild(props.compId)) return;
-              e.stopPropagation();
+            // onMousedown={(e) => {
+            //   if (helper.isGroupCompChild(props.compId)) return;
+            //   e.stopPropagation();
 
-              if (store.isEditMode) {
-                actions.pickComp(props.compId);
-              }
-            }}
+            //   if (store.isEditMode) {
+            //     actions.pickComp(props.compId);
+            //   }
+            // }}
 
             onMousemove={(e) => {
               if (

+ 8 - 7
src/modules/editor/components/Viewport/Content/index.tsx

@@ -56,9 +56,7 @@ export default defineUI({
                         <Container
                           behaiver="drop-zone"
                           class={store.isEditPage ? "!min-h-750px" : ""}
-                          drag-handle-selector=".draganchor"
-                          drop-placeholder={false}
-                          animation-duration={0}
+                          // drag-handle-selector=".draganchor"
                           ref={containRef}
                           should-accept-drop={(
                             sourceContainerOptions: any,
@@ -85,7 +83,10 @@ export default defineUI({
                             }
                           }}
                           onDragStart={() => (state.draging = true)}
-                          onDragEnd={() => (state.draging = false)}
+                          onDragEnd={() => {
+                            state.draging = false
+                            controls.selectCtrl.selecteObjs([])
+                          }}
                           non-drag-area-selector={".drag-disable"}
                         >
                           {children}
@@ -104,9 +105,9 @@ export default defineUI({
                           !state.draging && (
                             <Transfer key={store.currCompId + streamCardIndex} />
                           )} */}
-
-                        
-                        <SelectTransfer />
+                        {
+                          !state.draging && <SelectTransfer />
+                        }
                       </>
                     );
                   },

+ 9 - 6
src/modules/editor/controllers/SelectCtrl/index.ts

@@ -81,8 +81,8 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
     this._selCanvaseSize.h = selCanvas.height * 2;
 
     document.addEventListener("mousedown", this.onDocMouseDown.bind(this), {capture: true});
-    document.addEventListener("mousemove", this.onDocMouseMove.bind(this));
-    document.addEventListener("mouseup", this.onDocMouseUp.bind(this));
+    document.addEventListener("mousemove", this.onDocMouseMove.bind(this), {capture: true});
+    document.addEventListener("mouseup", this.onDocMouseUp.bind(this), {capture: true});
 
     window.addEventListener("resize", this.onResize.bind(this));
   }
@@ -283,10 +283,13 @@ export class SelectCtrl extends ModuleControl<EditorModule> {
 
   onDocMouseMove(e: MouseEvent) {
     if (!this.pageEl) return;
-
-    if (!this._downed) {
-      this.checkHover();
-      return;
+    // if (!this._downed) {
+    //   this.checkHover();
+    //   return;
+    // }
+    if (this._state) {
+        e.preventDefault();
+        e.stopPropagation();
     }
 
     switch (this._state) {

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

@@ -24,12 +24,20 @@ export const editActions = EditorModule.action({
   // 通过点击添加组件到画布
   async clickCompToDesign(compKey: ICompKeys, cb?: (comp: DesignComp) => void) {
 
+    //点击默认都创建一个容器
+    //创建容器
+    const isCreatCard =  compKey != "Text"
     let yOffset = 0;
-    if (this.store.currCompId != this.store.currStreamCardId) {
+    if (this.store.currCompId != this.store.currStreamCardId && !isCreatCard) {
         const bound = this.helper.getCardCompBound(this.store.currCompId);
         yOffset = bound.y + bound.h
     }
 
+    if (isCreatCard) { //先创建卡片
+      const index = this.store.streamCardIds.indexOf(this.store.currStreamCardId) + 1;
+      const compId = await this.store.insertDesignContent("Container", index);
+      this.actions.pickComp(compId);
+    }
     await this.actions.addCompToDesign(compKey);
     const { currComp } = this.store;
     cb?.(currComp);
@@ -39,6 +47,7 @@ export const editActions = EditorModule.action({
     const selectCtrl = this.controls.selectCtrl;
     let xOffset = this.helper.designSizeToPx(375 - (currComp.layout.size?.[0] || 750) / 2);
     selectCtrl.translate(xOffset, yOffset);
+    selectCtrl.selecteObjs([]);
 
     //扩展
     this.helper.extendStreamCard(this.store.currStreamCardId);