Skip to content

Commit be1b084

Browse files
committed
Fix UIScale9Sprite:setColor() (cocos2d#3383)
1 parent 2b3a2df commit be1b084

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

extensions/ccui/base-classes/UIScale9Sprite.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -288,9 +288,16 @@ ccui.Scale9Sprite = cc.Scale9Sprite = cc.Node.extend(/** @lends ccui.Scale9Sprit
288288
this._renderCmd.setDirtyFlag(cc.Node._dirtyFlags.cacheDirty);
289289
},
290290

291+
getColor: function () {
292+
return this._color;
293+
},
294+
291295
/** Color: conforms to CCRGBAProtocol protocol */
292296
setColor: function (color) {
293-
cc.Node.prototype.setColor.call(this, color);
297+
// Intentionally not calling super().
298+
// Instead, setColor() is called on each scale child so that
299+
// tint is only applied once.
300+
this._color = color;
294301
if(this._scale9Enabled) {
295302
var scaleChildren = this._renderers;
296303
for (var i = 0; i < scaleChildren.length; i++) {

0 commit comments

Comments
 (0)