|
@@ -95,6 +95,9 @@ export class new_frame extends Component {
|
|
|
}
|
|
|
|
|
|
let res_sf = control.res_map.get(this.m_data.url_name)
|
|
|
+ if(res_sf==undefined||res_sf==null) {
|
|
|
+ return tools.showToast('资源sf是空的')
|
|
|
+ }
|
|
|
this.m_data.size_width = res_sf.originalSize.width
|
|
|
this.m_data.size_height = res_sf.originalSize.height
|
|
|
this.size_width.getComponent(EditBox).string = this.m_data.size_width.toString()
|
|
@@ -104,19 +107,25 @@ export class new_frame extends Component {
|
|
|
|
|
|
this.btn_select_res.on(Node.EventType.TOUCH_END,()=>{
|
|
|
// console.log('选择资源')
|
|
|
+ let is_reset = false
|
|
|
+ if(this.m_data.url_name.length == 0||this.m_data.url_name =='空') {
|
|
|
+ is_reset = true
|
|
|
+ }
|
|
|
tools.select_res_list((data:bag_item_data)=>{
|
|
|
this.m_data.url = data.url;
|
|
|
this.m_data.url_name = data.name;
|
|
|
|
|
|
let res_sf = control.res_map.get(this.m_data.url_name)
|
|
|
this.hide_spr.getComponent(Sprite).spriteFrame = res_sf
|
|
|
- this.m_data.size_width = res_sf.originalSize.width
|
|
|
- this.m_data.size_height = res_sf.originalSize.height
|
|
|
- this.size_width.getComponent(EditBox).string = this.m_data.size_width.toString()
|
|
|
- this.size_height.getComponent(EditBox).string = this.m_data.size_height.toString()
|
|
|
- this.setupInitAnchorPointXY()
|
|
|
- this.setupSprRatationAction()
|
|
|
- this.setupSprContentSize()
|
|
|
+ if(is_reset) {
|
|
|
+ this.m_data.size_width = res_sf.originalSize.width
|
|
|
+ this.m_data.size_height = res_sf.originalSize.height
|
|
|
+ this.size_width.getComponent(EditBox).string = this.m_data.size_width.toString()
|
|
|
+ this.size_height.getComponent(EditBox).string = this.m_data.size_height.toString()
|
|
|
+ this.setupInitAnchorPointXY()
|
|
|
+ this.setupSprRatationAction()
|
|
|
+ this.setupSprContentSize()
|
|
|
+ }
|
|
|
})
|
|
|
})
|
|
|
|