future 1 anno fa
parent
commit
694832cb53
1 ha cambiato i file con 11 aggiunte e 7 eliminazioni
  1. 11 7
      assets/script/edit/animation/new_frame.ts

+ 11 - 7
assets/script/edit/animation/new_frame.ts

@@ -191,8 +191,16 @@ export class new_frame extends Component {
             if(up_frame.rotation==undefined||up_frame==null){
                 up_frame.rotation = 0
             }
+            if(up_frame.anchor_point_x==undefined||up_frame==null) {
+                up_frame.anchor_point_x = 0.5
+            }
+            if(up_frame.anchor_point_y==undefined||up_frame==null) {
+                up_frame.anchor_point_y = 0.5
+            }
         }
-        this.m_data.rotation =   up_frame?up_frame.rotation:0;
+        this.m_data.rotation = up_frame?up_frame.rotation:0
+        this.m_data.anchor_point_x = up_frame?up_frame.anchor_point_x:0.5
+        this.m_data.anchor_point_y = up_frame?up_frame.anchor_point_y:0.5
         this.lab_origin_pos.getComponent(Label).string = `(x:${Math.floor(att.x)},y:${Math.floor(att.y)})`
         this.lab_origin_size.getComponent(Label).string = `(w:${att.width},h:${att.height})`
         this.initAtt()
@@ -238,12 +246,8 @@ export class new_frame extends Component {
             this.m_data.anchor_point_y = 0.5;
         }
         this.rotation.getComponent(EditBox).string =  this.m_data.rotation.toString()
-        if(this.edit_status) {
-            this.anchor_point_x.getComponent(EditBox).string = this.m_data.anchor_point_x.toString()
-            this.anchor_point_y.getComponent(EditBox).string = this.m_data.anchor_point_y.toString()
-        } else {
-            this.setupInitAnchorPointXY()
-        }
+        this.anchor_point_x.getComponent(EditBox).string = this.m_data.anchor_point_x.toString()
+        this.anchor_point_y.getComponent(EditBox).string = this.m_data.anchor_point_y.toString()
 
         this.setupSprContentSize()
     }