yeoolhj 1 year ago
parent
commit
5b09f1327c

+ 2 - 2
src/dict/apis.ts

@@ -14,8 +14,8 @@ const Dict_Apis = {
   queentreeLocal: base,
   auth: `${baseURL}${baseVersion}/usercenter`,
   queentree: `${baseURL}${treeVersion}/assetcenter`,
-  // promotion: `${baseURL}${baseVersion}/promotion`,
-  promotion: `${localURL}/promotion`,
+  promotion: `${baseURL}${baseVersion}/promotion`,
+  // promotion: `${localURL}/promotion`,
 };
 
 export { Dict_Apis };

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

@@ -75,7 +75,7 @@ export const Transfer = defineComponent({
             <div
               class={resizeStyle}
               style={{ marginBottom: "-" + transferStyle.height }}
-              onMousedown={(e) => transferCtrl.mousedown(e, "resize")}
+              onMousedown={(e) => transferCtrl.mousedown(e, "scale")}
             ></div>
             <div class={toolbarStyle}>
               {toolbarOpts.map((item) => {

+ 6 - 0
src/modules/editor/controllers/TransferCtrl/transforms/transform.ts

@@ -7,6 +7,7 @@ function getTransform(this: TransferCtrl, transType: string) {
     x: transform.x || 0,
     y: transform.y || 0,
     r: transform.r || 0,
+    s: transform.s || 1,
   };
   switch (transType) {
     case "move":
@@ -15,6 +16,10 @@ function getTransform(this: TransferCtrl, transType: string) {
       break;
     case "rotate":
       offset.r = (offset.r + transEvent.offsetX * -1) % 360;
+      break;
+    case "scale":
+      offset.s = +((offset.s * (1 + (transEvent.offsetX * 2) / transEvent.width)).toFixed(2))
+      console.log(offset.s);
   }
 
   return offset;
@@ -36,3 +41,4 @@ const transform: TransCreateFn = (transType: string) => ({
 
 export const move = transform.bind(null, "move");
 export const rotate = transform.bind(null, "rotate");
+export const scale = transform.bind(null, "scale");

+ 6 - 1
src/modules/editor/objects/DesignTemp/creates/createCompStyle.ts

@@ -19,7 +19,9 @@ export function createCompStyle(module: EditorModule, layout: Layout) {
 
   if (layout.margin) {
     style.margin = layout.margin;
-  } else if (layout.transform) {
+  }
+  
+  if (layout.transform) {
     if (layout.transform.x) {
       transform.translateX = designToNaturalSize(layout.transform.x);
     }
@@ -29,6 +31,9 @@ export function createCompStyle(module: EditorModule, layout: Layout) {
     if (layout.transform.r) {
       transform.rotate = layout.transform.r + "deg";
     }
+    if (layout.transform.s) {
+      transform.scale = layout.transform.s;
+    }
   }
 
   if (layout.padding) {

+ 1 - 0
src/modules/editor/typings.ts

@@ -13,6 +13,7 @@ export type Layout = {
     r?: number; // rotate
     x?: number; // translateX
     y?: number; // marginTop
+    s?: number; // scale
   };
   zIndex?: number;
   margin?: string;