Skip to content

Commit b7a02e9

Browse files
committed
Update cocos2d/base_nodes/CCNode.js
removed bitwise comparison in the context.translate. It caused an issue with scaled layers, because it would convert floats to int, removing the decimal part of a number. This caused animations to run 'chunky', when the container/sprite/node was scaled. I don't know why this was added in the first place, probably to always have a number for the translation.
1 parent 82494e9 commit b7a02e9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

cocos2d/base_nodes/CCNode.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,15 +1342,15 @@ cc.Node = cc.Class.extend(/** @lends cc.Node# */{
13421342
// transformations
13431343
if (!this._ignoreAnchorPointForPosition) {
13441344
if (this._parent)
1345-
context.translate(0 | (this._position.x - this._parent._anchorPointInPoints.x), -(0 | (this._position.y - this._parent._anchorPointInPoints.y)));
1345+
context.translate((this._position.x - this._parent._anchorPointInPoints.x), -((this._position.y - this._parent._anchorPointInPoints.y)));
13461346
else
1347-
context.translate(0 | this._position.x, -(0 | this._position.y));
1347+
context.translate(this._position.x, -(this._position.y));
13481348
} else {
13491349
if (this._parent) {
1350-
context.translate(0 | ( this._position.x - this._parent._anchorPointInPoints.x + this._anchorPointInPoints.x),
1351-
-(0 | (this._position.y - this._parent._anchorPointInPoints.y + this._anchorPointInPoints.y)));
1350+
context.translate(( this._position.x - this._parent._anchorPointInPoints.x + this._anchorPointInPoints.x),
1351+
-((this._position.y - this._parent._anchorPointInPoints.y + this._anchorPointInPoints.y)));
13521352
} else {
1353-
context.translate(0 | ( this._position.x + this._anchorPointInPoints.x), -(0 | (this._position.y + this._anchorPointInPoints.y)));
1353+
context.translate(( this._position.x + this._anchorPointInPoints.x), -((this._position.y + this._anchorPointInPoints.y)));
13541354
}
13551355
}
13561356

0 commit comments

Comments
 (0)