Skip to content

Commit 0e70d57

Browse files
committed
closed cocos2d#3256: Fixed a bug of CCActionInterval that it will error when target have not own RGBAProtocol.
1 parent c8f3cd9 commit 0e70d57

File tree

3 files changed

+22
-10
lines changed

3 files changed

+22
-10
lines changed

cocos2d/actions/CCActionInterval.js

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1827,7 +1827,9 @@ cc.FadeIn = cc.ActionInterval.extend(/** @lends cc.FadeIn# */{
18271827
* @param {Number} time time in seconds
18281828
*/
18291829
update:function (time) {
1830-
this._target.setOpacity(255 * time);
1830+
if (this._target.RGBAProtocol) {
1831+
this._target.setOpacity(255 * time);
1832+
}
18311833
},
18321834

18331835
/**
@@ -1872,7 +1874,9 @@ cc.FadeOut = cc.ActionInterval.extend(/** @lends cc.FadeOut# */{
18721874
* @param {Number} time time in seconds
18731875
*/
18741876
update:function (time) {
1875-
this._target.setOpacity(255 * (1 - time));
1877+
if (this._target.RGBAProtocol) {
1878+
this._target.setOpacity(255 * (1 - time));
1879+
}
18761880
},
18771881

18781882
/**
@@ -1948,15 +1952,19 @@ cc.FadeTo = cc.ActionInterval.extend(/** @lends cc.FadeTo# */{
19481952
* @param {Number} time time in seconds
19491953
*/
19501954
update:function (time) {
1951-
this._target.setOpacity((this._fromOpacity + (this._toOpacity - this._fromOpacity) * time));
1955+
if (this._target.RGBAProtocol) {
1956+
this._target.setOpacity((this._fromOpacity + (this._toOpacity - this._fromOpacity) * time));
1957+
}
19521958
},
19531959

19541960
/**
19551961
* @param {cc.Sprite} target
19561962
*/
19571963
startWithTarget:function (target) {
19581964
cc.ActionInterval.prototype.startWithTarget.call(this, target);
1959-
this._fromOpacity = target.getOpacity();
1965+
if(this._target.RGBAProtocol){
1966+
this._fromOpacity = target.getOpacity();
1967+
}
19601968
}
19611969
});
19621970

@@ -2020,16 +2028,20 @@ cc.TintTo = cc.ActionInterval.extend(/** @lends cc.TintTo# */{
20202028
*/
20212029
startWithTarget:function (target) {
20222030
cc.ActionInterval.prototype.startWithTarget.call(this, target);
2023-
this._from = this._target.getColor();
2031+
if (this._target.RGBAProtocol) {
2032+
this._from = this._target.getColor();
2033+
}
20242034
},
20252035

20262036
/**
20272037
* @param {Number} time time in seconds
20282038
*/
20292039
update:function (time) {
20302040
var locFrom = this._from, locTo = this._to;
2031-
this._target.setColor(cc.c3b(locFrom.r + (locTo.r - locFrom.r) * time,
2032-
(locFrom.g + (locTo.g - locFrom.g) * time), (locFrom.b + (locTo.b - locFrom.b) * time)));
2041+
if (this._target.RGBAProtocol) {
2042+
this._target.setColor(cc.c3b(locFrom.r + (locTo.r - locFrom.r) * time,
2043+
(locFrom.g + (locTo.g - locFrom.g) * time), (locFrom.b + (locTo.b - locFrom.b) * time)));
2044+
}
20332045
}
20342046
});
20352047

cocos2d/tileMap_parallax_nodes/CCTMXLayer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,10 @@ cc.TMXLayer = cc.SpriteBatchNode.extend(/** @lends cc.TMXLayer# */{
105105
cc.Node.prototype.setContentSize.call(this, size);
106106

107107
if(cc.renderContextType === cc.CANVAS){
108+
var eglViewer = cc.EGLView.getInstance();
108109
var locCanvas = this._cacheCanvas;
109-
locCanvas.width = 0|(size.width * 1.5);
110-
locCanvas.height = 0|(size.height * 1.5);
110+
locCanvas.width = 0|(size.width * 1.5 * eglViewer._scaleX);
111+
locCanvas.height = 0|(size.height * 1.5 * eglViewer._scaleY);
111112
this._cacheContext.translate(0, locCanvas.height);
112113
var locContentSize = this._cacheTexture._contentSize;
113114
locContentSize.width = locCanvas.width;

extensions/CocoStudio/GUI/System/UIHelper.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,6 @@ ccs.UIHelper.seekActionWidgetByActionTag = function (root, tag) {
107107
return root;
108108
}
109109
var arrayRootChildren = root.getChildren();
110-
var length = arrayRootChildren.num;
111110
for (var i = 0; i < arrayRootChildren.length; i++) {
112111
var child = arrayRootChildren[i];
113112
var res = this.seekActionWidgetByActionTag(child, tag);

0 commit comments

Comments
 (0)