Skip to content

Commit 78bcb2b

Browse files
committed
Merge pull request cocos2d#1772 from VisualSJ/develop-3.0
Fixed a bug that ant. Variable name changed
2 parents a59cb07 + df51ddd commit 78bcb2b

File tree

11 files changed

+605
-617
lines changed

11 files changed

+605
-617
lines changed

extensions/ccui/base-classes/UIWidget.js

Lines changed: 177 additions & 177 deletions
Large diffs are not rendered by default.

extensions/ccui/layouts/UILayout.js

Lines changed: 43 additions & 55 deletions
Large diffs are not rendered by default.

extensions/ccui/uiwidgets/UIButton.js

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
6363
_normalTextureLoaded: false,
6464
_pressedTextureLoaded: false,
6565
_disabledTextureLoaded: false,
66-
_className:"Button",
66+
_className: "Button",
6767
ctor: function () {
6868
ccui.Widget.prototype.ctor.call(this);
6969
this._buttonNormalRenderer = null;
@@ -97,7 +97,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
9797
},
9898

9999
init: function () {
100-
if (ccui.Widget.prototype.init.call(this)){
100+
if (ccui.Widget.prototype.init.call(this)) {
101101
this.setTouchEnabled(true);
102102
return true;
103103
}
@@ -165,7 +165,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
165165
* Get button is using scale9 renderer or not.
166166
* @returns {Boolean}
167167
*/
168-
isScale9Enabled:function(){
168+
isScale9Enabled: function () {
169169
return this._scale9Enabled;
170170
},
171171

@@ -202,7 +202,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
202202
if (!normal) {
203203
return;
204204
}
205-
texType = texType||ccui.Widget.LOCAL_TEXTURE;
205+
texType = texType || ccui.Widget.LOCAL_TEXTURE;
206206
this._normalFileName = normal;
207207
this._normalTexType = texType;
208208
var buttonNormalRenderer = this._buttonNormalRenderer;
@@ -218,17 +218,17 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
218218
}
219219

220220
var buttonRenderSize = buttonNormalRenderer.getContentSize();
221-
if(buttonNormalRenderer.textureLoaded()){
221+
if (buttonNormalRenderer.textureLoaded()) {
222222
this._normalTextureSize.width = buttonRenderSize.width;
223223
this._normalTextureSize.height = buttonRenderSize.height;
224-
}else{
225-
buttonNormalRenderer.addLoadedEventListener(function(){
224+
} else {
225+
buttonNormalRenderer.addLoadedEventListener(function () {
226226
this._normalTextureSize = buttonNormalRenderer.getContentSize();
227227
if (buttonNormalRenderer.setCapInsets) {
228228
buttonNormalRenderer.setCapInsets(this._capInsetsNormal);
229229
}
230230
this.normalTextureScaleChangedWithSize();
231-
},this);
231+
}, this);
232232
this._normalTextureSize.width = this._customSize.width;
233233
this._normalTextureSize.height = this._customSize.height;
234234
}
@@ -268,16 +268,16 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
268268
break;
269269
}
270270

271-
if(clickedRenderer.textureLoaded()){
271+
if (clickedRenderer.textureLoaded()) {
272272
this._pressedTextureSize = clickedRenderer.getContentSize();
273-
}else{
274-
clickedRenderer.addLoadedEventListener(function(){
273+
} else {
274+
clickedRenderer.addLoadedEventListener(function () {
275275
this._pressedTextureSize = clickedRenderer.getContentSize();
276276
if (clickedRenderer.setCapInsets) {
277277
clickedRenderer.setCapInsets(this._capInsetsNormal);
278278
}
279279
this.pressedTextureScaleChangedWithSize();
280-
},this);
280+
}, this);
281281
this._pressedTextureSize.width = this._customSize.width;
282282
this._pressedTextureSize.height = this._customSize.height;
283283
}
@@ -317,16 +317,16 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
317317
break;
318318
}
319319

320-
if(disableRenderer.textureLoaded()){
320+
if (disableRenderer.textureLoaded()) {
321321
this._disabledTextureSize = disableRenderer.getContentSize();
322-
}else{
323-
disableRenderer.addLoadedEventListener(function(){
322+
} else {
323+
disableRenderer.addLoadedEventListener(function () {
324324
this._disabledTextureSize = disableRenderer.getContentSize();
325325
if (disableRenderer.setCapInsets) {
326326
disableRenderer.setCapInsets(this._capInsetsNormal);
327327
}
328328
this.disabledTextureScaleChangedWithSize();
329-
},this);
329+
}, this);
330330
this._disabledTextureSize.width = this._customSize.width;
331331
this._disabledTextureSize.height = this._customSize.height;
332332
}
@@ -368,7 +368,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
368368
* Get normal renderer cap insets .
369369
* @returns {cc.Rect}
370370
*/
371-
getCapInsetNormalRenderer:function(){
371+
getCapInsetNormalRenderer: function () {
372372
return this._capInsetsNormal;
373373
},
374374

@@ -388,7 +388,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
388388
* Get pressed renderer cap insets .
389389
* @returns {cc.Rect}
390390
*/
391-
getCapInsetPressedRenderer:function(){
391+
getCapInsetPressedRenderer: function () {
392392
return this._capInsetsPressed;
393393
},
394394

@@ -408,7 +408,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
408408
* Get disable renderer cap insets .
409409
* @returns {cc.Rect}
410410
*/
411-
getCapInsetDisabledRenderer:function(){
411+
getCapInsetDisabledRenderer: function () {
412412
return this._capInsetsDisabled;
413413
},
414414

@@ -500,7 +500,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
500500
this._buttonClickedRenderer.setScaleY(1);
501501
this._buttonDisableRenderer.setScaleY(1);
502502
}
503-
}else{
503+
} else {
504504
this._buttonNormalRenderer.setFlippedY(this._flippedY);
505505
this._buttonClickedRenderer.setFlippedY(this._flippedY);
506506
this._buttonDisableRenderer.setFlippedY(this._flippedY);
@@ -513,35 +513,35 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
513513
* @param {Number} [y] The anchor point.y of UIButton.
514514
*/
515515
setAnchorPoint: function (point, y) {
516-
if(y === undefined){
517-
ccui.Widget.prototype.setAnchorPoint.call(this, point);
518-
this._buttonNormalRenderer.setAnchorPoint(point);
519-
this._buttonClickedRenderer.setAnchorPoint(point);
520-
this._buttonDisableRenderer.setAnchorPoint(point);
516+
if (y === undefined) {
517+
ccui.Widget.prototype.setAnchorPoint.call(this, point);
518+
this._buttonNormalRenderer.setAnchorPoint(point);
519+
this._buttonClickedRenderer.setAnchorPoint(point);
520+
this._buttonDisableRenderer.setAnchorPoint(point);
521521
} else {
522-
ccui.Widget.prototype.setAnchorPoint.call(this, point, y);
523-
this._buttonNormalRenderer.setAnchorPoint(point, y);
524-
this._buttonClickedRenderer.setAnchorPoint(point, y);
525-
this._buttonDisableRenderer.setAnchorPoint(point, y);
526-
}
527-
this._titleRenderer.setPosition(this._size.width * (0.5 - this._anchorPoint.x), this._size.height * (0.5 - this._anchorPoint.y));
528-
},
529-
_setAnchorX: function (value) {
530-
ccui.Widget.prototype._setAnchorX.call(this, value);
531-
this._buttonNormalRenderer._setAnchorX(value);
532-
this._buttonClickedRenderer._setAnchorX(value);
533-
this._buttonDisableRenderer._setAnchorX(value);
534-
535-
this._titleRenderer.setPositionX(this._size.width * (0.5 - this._anchorPoint.x));
536-
},
537-
_setAnchorY: function (value) {
538-
ccui.Widget.prototype._setAnchorY.call(this, value);
539-
this._buttonNormalRenderer._setAnchorY(value);
540-
this._buttonClickedRenderer._setAnchorY(value);
541-
this._buttonDisableRenderer._setAnchorY(value);
542-
543-
this._titleRenderer.setPositionY(this._size.height * (0.5 - this._anchorPoint.y));
544-
},
522+
ccui.Widget.prototype.setAnchorPoint.call(this, point, y);
523+
this._buttonNormalRenderer.setAnchorPoint(point, y);
524+
this._buttonClickedRenderer.setAnchorPoint(point, y);
525+
this._buttonDisableRenderer.setAnchorPoint(point, y);
526+
}
527+
this._titleRenderer.setPosition(this._size.width * (0.5 - this._anchorPoint.x), this._size.height * (0.5 - this._anchorPoint.y));
528+
},
529+
_setAnchorX: function (value) {
530+
ccui.Widget.prototype._setAnchorX.call(this, value);
531+
this._buttonNormalRenderer._setAnchorX(value);
532+
this._buttonClickedRenderer._setAnchorX(value);
533+
this._buttonDisableRenderer._setAnchorX(value);
534+
535+
this._titleRenderer.setPositionX(this._size.width * (0.5 - this._anchorPoint.x));
536+
},
537+
_setAnchorY: function (value) {
538+
ccui.Widget.prototype._setAnchorY.call(this, value);
539+
this._buttonNormalRenderer._setAnchorY(value);
540+
this._buttonClickedRenderer._setAnchorY(value);
541+
this._buttonDisableRenderer._setAnchorY(value);
542+
543+
this._titleRenderer.setPositionY(this._size.height * (0.5 - this._anchorPoint.y));
544+
},
545545

546546
onSizeChanged: function () {
547547
ccui.Widget.prototype.onSizeChanged.call(this);
@@ -557,12 +557,12 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
557557
getContentSize: function () {
558558
return this._normalTextureSize;
559559
},
560-
_getWidth: function () {
561-
return this._scale9Enabled ? this._size.width : this._normalTextureSize.width;
562-
},
563-
_getHeight: function () {
564-
return this._scale9Enabled ? this._size.height : this._normalTextureSize.height;
565-
},
560+
_getWidth: function () {
561+
return this._scale9Enabled ? this._size.width : this._normalTextureSize.width;
562+
},
563+
_getHeight: function () {
564+
return this._scale9Enabled ? this._size.height : this._normalTextureSize.height;
565+
},
566566

567567
/**
568568
* Gets the Virtual Renderer of widget.
@@ -741,12 +741,12 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
741741
return this._titleRenderer.getFontName();
742742
},
743743

744-
_setTitleFont: function (font) {
745-
this._titleRenderer.font = font;
746-
},
747-
_getTitleFont: function () {
748-
return this._titleRenderer.font;
749-
},
744+
_setTitleFont: function (font) {
745+
this._titleRenderer.font = font;
746+
},
747+
_getTitleFont: function () {
748+
return this._titleRenderer.font;
749+
},
750750

751751
updateTextureColor: function () {
752752
this.updateColorToRenderer(this._buttonNormalRenderer);
@@ -768,11 +768,11 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
768768
return "Button";
769769
},
770770

771-
createCloneInstance:function(){
771+
createCloneInstance: function () {
772772
return ccui.Button.create();
773773
},
774774

775-
copySpecialProperties:function(uiButton){
775+
copySpecialProperties: function (uiButton) {
776776
this._prevIgnoreSize = uiButton._prevIgnoreSize;
777777
this.setScale9Enabled(uiButton._scale9Enabled);
778778
this.loadTextureNormal(uiButton._normalFileName, uiButton._normalTexType);
@@ -790,7 +790,7 @@ ccui.Button = ccui.Widget.extend(/** @lends ccui.Button# */{
790790

791791
});
792792

793-
window._p = ccui.Button.prototype;
793+
var _p = ccui.Button.prototype;
794794

795795
// Extended properties
796796
/** @expose */
@@ -809,7 +809,7 @@ cc.defineGetterSetter(_p, "titleFontName", _p.getTitleFontName, _p.setTitleFontN
809809
_p.titleColor;
810810
cc.defineGetterSetter(_p, "titleColor", _p.getTitleColor, _p.setTitleColor);
811811

812-
delete window._p;
812+
_p = null;
813813

814814
/**
815815
* allocates and initializes a UIButton.

0 commit comments

Comments
 (0)