Prechádzať zdrojové kódy

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

lianghongjie 1 rok pred
rodič
commit
8a84de3af2

+ 1 - 1
src/modules/editor/components/CompUI/basicUI/Transfer/index.tsx

@@ -37,7 +37,7 @@ export const Transfer = defineComponent({
       return (
         transferStyle.width && (
           <div
-            class="absolute transfer"
+            class="absolute transfer z-999"
             style={{
               top: transferStyle.top,
               left: transferStyle.left,

+ 2 - 2
src/modules/editor/components/CompUI/basicUI/Transfer/streamCard.tsx

@@ -30,7 +30,7 @@ export const StreamCardTransfer = defineComponent({
       return (
         transferStyle.width && (
           <div
-            class="transfer absolute"
+            class="transfer absolute z-998"
             style={{
               top: transferStyle.top,
               left: transferStyle.left,
@@ -79,7 +79,7 @@ const borderStyle = css`
   height: 100%;
   outline: 2px solid @inf-primary-color;
   pointer-events: none;
-  z-index: 999;
+  /* z-index: 999; */
   box-shadow: 0 0 0 3000px rgba(0, 0, 0, 0.4);
 `;
 

+ 17 - 4
src/modules/editor/controllers/TransferCtrl/index.ts

@@ -38,12 +38,18 @@ export class TransferCtrl extends ModuleControl<EditorModule> {
     width: "",
     height: "",
     transform: {
+      scale: 1,
       rotate: "0deg",
       translateX: "-50%",
       translateY: "-50%",
     },
   });
 
+  originPiont = {
+    x: 0,
+    y: 0,
+  };
+
   init(pageEl: HTMLElement) {
     this.groupCtrl.init();
 
@@ -117,20 +123,27 @@ export class TransferCtrl extends ModuleControl<EditorModule> {
     const matrix = new Matrix();
     matrix.setFormDiv(this.compEl);
 
-    this.transferStyle.width = this.compEl.clientWidth + "px";
-    this.transferStyle.height = this.compEl.clientHeight + "px";
+    const width = this.compEl.clientWidth * matrix.getScale();
+    const height = this.compEl.clientHeight * matrix.getScale();
+
+    this.transferStyle.width = width + "px";
+    this.transferStyle.height = height + "px";
     this.transferStyle.top = rect.top + rect.height / 2 - pageRect.top + "px";
     this.transferStyle.left = rect.left + rect.width / 2 - pageRect.left + "px";
     if (!this.transferStyle.transform) {
       this.transferStyle.transform = {
+        scale: 1,
         rotate: "0deg",
         translateX: "-50%",
         translateY: "-50%",
       };
     }
+    this.transferStyle.transform.scale = matrix.getScale();
     this.transferStyle.transform.rotate = matrix.getRotate() + "deg";
-    this.transferStyle.transform.translateY =
-      "-" + this.compEl.clientHeight / 2 + "px";
+    this.transferStyle.transform.translateY = "-" + height / 2 + "px";
+
+    this.originPiont.x = rect.left + rect.width / 2;
+    this.originPiont.y = rect.top + rect.height / 2;
   }
 
   resetStyle() {

+ 12 - 2
src/modules/editor/controllers/TransferCtrl/transforms/transform.ts

@@ -1,7 +1,7 @@
 import { TransCreateFn, TransferCtrl } from "..";
 
 function getTransform(this: TransferCtrl, transType: string) {
-  const { transEvent } = this;
+  const { transEvent, originPiont } = this;
   const { transform = {} } = this.currComp?.layout || {};
   const offset = {
     x: transform.x || 0,
@@ -9,13 +9,23 @@ function getTransform(this: TransferCtrl, transType: string) {
     r: transform.r || 0,
     s: transform.s || 1,
   };
+
+  const offsetX = transEvent.offsetX + transEvent.startX - originPiont.x;
+  const offsetY = transEvent.offsetY + transEvent.startY - originPiont.y;
+
   switch (transType) {
     case "move":
       offset.x += transEvent.offsetX * 2;
       offset.y += transEvent.offsetY * 2;
       break;
     case "rotate":
-      offset.r = (offset.r + transEvent.offsetX * -1) % 360;
+      if (offsetY > 0) {
+        offset.r = (Math.atan(-offsetX / offsetY) * 180) / Math.PI;
+      } else if (offsetX < 0) {
+        offset.r = (Math.atan(offsetY / offsetX) * 180) / Math.PI + 90;
+      } else {
+        offset.r = (Math.atan(offsetY / offsetX) * 180) / Math.PI - 90;
+      }
       break;
     case "scale":
       offset.s = +(

+ 0 - 1
src/modules/editor/module/helpers/index.ts

@@ -60,7 +60,6 @@ export const helpers = EditorModule.helper({
   },
   isCustomChildComp(comp: DesignComp): boolean {
     const parentComp = this.helper.findParentComp(comp.id);
-
     if (!parentComp) return false;
     const i =
       parentComp.children.default?.findIndex((d) => d === comp.id) ?? -1;

+ 2 - 1
src/styles/theme-antd.js

@@ -6,7 +6,8 @@ module.exports = Object.assign(
   }),
   {
     "primary-color": "#E88B00",
-    "component-background": "#ffffff",
+    // "component-background": "#ffffff",
+    "select-clear-background":"transparent",
     "tree-title-height": "32px",
     "modal-content-bg": "#262626",
   }