Ver Fonte

修复选择bug

liwei há 1 ano atrás
pai
commit
4883ee2b7a

+ 10 - 6
src/modules/editor/components/Viewport/Content/index.tsx

@@ -81,13 +81,17 @@ export default defineUI({
                     }
                   return (<Draggable>
                       <div key={item} class={["card-item relative transition-opacity hover:opacity-80"]} style={style} onClick={()=>{
-                          actions.pickComp(item, false);
+                         actions.selectObjs([]);
+                         actions.pickComp(item, false);
                       }}>
-                          <IconDelete onClick={()=>{
-                             actions.removeStreamCard(item);
-                          }} class="deleteitem absolute right-4px top-4px text-black" />
-
-                          <Comp compId={c.id} style={{transformOrigin:"0 0", pointerEvent:"none", transform: `scale(${80.0 / helper.designSizeToPx(c.layout.size[0])})`}} />
+                          {
+                              store.streamCardIds.length > 1 && <IconDelete onClick={()=>{
+                              actions.removeStreamCard(item);
+                            }} class="deleteitem absolute right-4px top-4px text-black" />
+                          }
+                          <div class="pointer-events-none">
+                              <Comp compId={c.id} style={{transformOrigin:"0 0", pointerEvent:"none", transform: `scale(${80.0 / helper.designSizeToPx(c.layout.size[0])})`}} />
+                          </div>
                       </div>
                     </Draggable>)
                   })

+ 9 - 0
src/modules/editor/module/actions/edit.tsx

@@ -251,6 +251,15 @@ export const editActions = EditorModule.action({
       // index = this.store.streamCardIds.indexOf(this.store.currStreamCardId) + 1;
       const compId = await this.store.insertDesignContent(compKey, index);
       this.actions.pickComp(compId);
+      
+      const c = this.helper.findComp(compId) as DesignComp;
+      c.layout.size[0] = this.controls.screenCtrl.getCurrScreenWidth();
+      c.layout.size[1] = this.controls.screenCtrl.getCurrScreenHeight();
+      
+      this.helper.extendStreamCard(compId);
+
+      this.actions.selectObjs([]);
+      
       return;
     }