liwei 1 year ago
parent
commit
4fcdf18557

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

@@ -17,13 +17,7 @@ export const Component = createUIComp({
       <div class="relative">
         <div class="relative">
           <div class={style}>
-            <Image.Component
-              style={{
-                width: designToNaturalSize(750),
-                height: designToNaturalSize(464),
-              }}
-              compId={children.bgImg}
-            />
+            <Image.Component compId={children.bgImg} />
           </div>
           <div
             class="absolute bottom-0 w-1/1 pl-40px pr-10px flex items-end justify-between transform translate-y-1/3"

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

@@ -27,6 +27,9 @@ export const { createComp, useCompData } = createCompHooks({
           y: 0,
           s: 1,
         },
+        layout: {
+          size: [750, 464],
+        },
       }),
     item1: () =>
       createCompId("Image", {

+ 3 - 3
src/modules/editor/controllers/CropperCtrl/index.ts

@@ -113,7 +113,6 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
 
         this.controls.historyCtrl.state.enable = false;
 
-
         const obj = new CompObject(imgComp);
         const w = obj.width, h = obj.height; //图片的宽高
         const r1 = h / w;
@@ -132,7 +131,7 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
         this.modifyCtrl.baseBox.h = cardBox.height;
         this.modifyCtrl.state.toolbarNames = ["Right", "Cross"];
 
-        const defaultScale =  imgComp.value.s == undefined || imgComp.value.s == 1 && imgComp.value.x == 0 && imgComp.value.y;
+        const defaultScale =  imgComp.value.s == undefined || (imgComp.value.s == 1 && imgComp.value.x == 0 && imgComp.value.y == 0);
         let scale = 1;
         let offsetX = 0;
         let offsetY = 0;
@@ -183,7 +182,8 @@ export class ImageCropperCtrl extends ModuleControl<EditorModule> {
         this.initValue.h = srcHeight;
 
          //获取obj的image图片的世界大小
-         const objC =  new ObjsContainer([obj]) //当前对象作为容器
+         const paths = this.helper.getCompTrees(id);
+         const objC =  new ObjsContainer([new CompObject(paths[2])]) //当前对象作为容器
         m.prepend(objC.parent.worldTransform);
         
         if (this.controls.selectCtrl.assistMagnet) {

+ 0 - 5
yarn.lock

@@ -8571,11 +8571,6 @@ vue-cli-plugin-windicss@~1.1.6:
     defu "^6.0.0"
     windicss-webpack-plugin "^1.7.4"
 
-vue-cropper@^1.0.9:
-  version "1.0.9"
-  resolved "http://124.70.149.18:4873/vue-cropper/-/vue-cropper-1.0.9.tgz#de402c57cadc221e9a2063399ff35bb04220ef22"
-  integrity sha512-JhQwxmjqmQohzI7sAp5O/Rfdxuw5HOEYkKjnp/De7iCi6c8Mv6M3N9HpMt9xgWCFchX3/DfXBv2axCZOCg3G8Q==
-
 vue-demi@*, vue-demi@>=0.14.0:
   version "0.14.5"
   resolved "http://124.70.149.18:4873/vue-demi/-/vue-demi-0.14.5.tgz#676d0463d1a1266d5ab5cba932e043d8f5f2fbd9"