future il y a 1 an
Parent
commit
6e1e455994
1 fichiers modifiés avec 3 ajouts et 2 suppressions
  1. 3 2
      assets/script/edit/widget_item.ts

+ 3 - 2
assets/script/edit/widget_item.ts

@@ -557,8 +557,8 @@ export class widget_item extends Component {
         this.m_att.remark = this.m_att.remark;
         this.m_att.height = this.spr.getComponent(UITransform).contentSize.height;
         this.m_att.width = this.spr.getComponent(UITransform).contentSize.width;
-        this.m_att.anchor_x = this.m_data.att.anchor_x
-        this.m_att.anchor_y = this.m_data.att.anchor_y
+        this.m_att.anchor_x = this.m_att.anchor_x==undefined?0.5:this.m_att.anchor_x
+        this.m_att.anchor_y = this.m_att.anchor_y==undefined?0.5:this.m_att.anchor_y
         this.m_att.rotation = this.m_att.rotation;
         this.m_att.x = this.node.position.x;
         this.m_att.widget_type = this.m_data.type;
@@ -580,6 +580,7 @@ export class widget_item extends Component {
             this.node.position =  new Vec3(this.m_att.x,this.m_att.y)
             this.node.getComponent(UITransform).setContentSize(new Size( this.m_att.width,this.m_att.height))
             this.spr.angle = this.m_att.rotation
+            this.spr.getComponent(UITransform).setAnchorPoint(new Vec2(this.m_att.anchor_x, this.m_att.anchor_y))
             if(this.m_att.drag_data!=null){
                 this.drag.position =  new Vec3(this.m_att.drag_data.drag_pos_x,this.m_att.drag_data.drag_pos_y)
                 this.drag.getComponent(UITransform).setContentSize(new Size(this.m_att.drag_data.drag_size_width ,this.m_att.drag_data.drag_size_height ))