Skip to content

Commit 9d831ea

Browse files
committed
Merge pull request #1405 from VisualSJ/develop-test
studio parser‘s issue
2 parents f5633cf + 0ae4d25 commit 9d831ea

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

frameworks/js-bindings/bindings/script/studio/parsers/timelineParser-2.x.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -526,27 +526,21 @@
526526

527527
var widget = new ccui.Button();
528528

529-
this.widgetAttributes(widget, json);
529+
loadTexture(json["NormalFileData"], resourcePath, function(path, type){
530+
widget.loadTextureNormal(path, type);
531+
});
532+
loadTexture(json["PressedFileData"], resourcePath, function(path, type){
533+
widget.loadTexturePressed(path, type);
534+
});
535+
loadTexture(json["DisabledFileData"], resourcePath, function(path, type){
536+
widget.loadTextureDisabled(path, type);
537+
});
530538

531539
var scale9Enabled = getParam(json["Scale9Enable"], false);
532-
if(scale9Enabled){
540+
if(scale9Enabled) {
533541
widget.setScale9Enabled(scale9Enabled);
534-
widget.setUnifySizeEnabled(false);
535-
widget.ignoreContentAdaptWithSize(false);
536-
537-
var capInsets = cc.rect(
538-
json["Scale9OriginX"] || 0,
539-
json["Scale9OriginY"] || 0,
540-
json["Scale9Width"] || 0,
541-
json["Scale9Height"] || 0
542-
);
543-
544-
widget.setCapInsets(capInsets);
545-
546542
}
547543

548-
setContentSize(widget, json["Size"]);
549-
550544
var text = json["ButtonText"];
551545
if(text != null)
552546
widget.setTitleText(text);
@@ -563,16 +557,6 @@
563557
if(textColor != null)
564558
widget.setTitleColor(getColor(textColor));
565559

566-
loadTexture(json["NormalFileData"], resourcePath, function(path, type){
567-
widget.loadTextureNormal(path, type);
568-
});
569-
loadTexture(json["PressedFileData"], resourcePath, function(path, type){
570-
widget.loadTexturePressed(path, type);
571-
});
572-
loadTexture(json["DisabledFileData"], resourcePath, function(path, type){
573-
widget.loadTextureDisabled(path, type);
574-
});
575-
576560
var displaystate = getParam(json["DisplayState"], true);
577561
widget.setBright(displaystate);
578562
widget.setEnabled(displaystate);
@@ -591,6 +575,22 @@
591575
widget.setTitleFontName(fontName);
592576
}
593577
}
578+
this.widgetAttributes(widget, json);
579+
580+
if(scale9Enabled) {
581+
widget.setUnifySizeEnabled(false);
582+
widget.ignoreContentAdaptWithSize(false);
583+
var capInsets = cc.rect(
584+
json["Scale9OriginX"] || 0,
585+
json["Scale9OriginY"] || 0,
586+
json["Scale9Width"] || 0,
587+
json["Scale9Height"] || 0
588+
);
589+
widget.setCapInsets(capInsets);
590+
591+
}
592+
593+
setContentSize(widget, json["Size"]);
594594

595595
return widget;
596596

0 commit comments

Comments
 (0)