mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-02 00:22:43 +08:00
Merge pull request #1122 from knoxHuang/v1.2
fix FlipX and FilpY bug for #fireball/issues/4156
This commit is contained in:
@@ -259,7 +259,7 @@ cc.FlipX = cc.ActionInstant.extend({
|
||||
},
|
||||
|
||||
update:function (dt) {
|
||||
this.target.scaleX = Math.abs(this.target.scaleX) * (this._flippedX ? 1 : -1);
|
||||
this.target.scaleX = Math.abs(this.target.scaleX) * (this._flippedX ? -1 : 1);
|
||||
},
|
||||
|
||||
reverse:function () {
|
||||
@@ -315,7 +315,7 @@ cc.FlipY = cc.ActionInstant.extend({
|
||||
},
|
||||
|
||||
update:function (dt) {
|
||||
this.target.scaleY = Math.abs(this.target.scaleY) * (this._flippedX ? 1 : -1);
|
||||
this.target.scaleY = Math.abs(this.target.scaleY) * (this._flippedY ? -1 : 1);
|
||||
},
|
||||
|
||||
reverse:function () {
|
||||
|
||||
@@ -133,6 +133,70 @@ cc.Follow.prototype.update = function(dt) {
|
||||
}
|
||||
};
|
||||
|
||||
var _FlipX = cc.FlipX;
|
||||
cc.FlipX = _FlipX.extend({
|
||||
_flippedX:false,
|
||||
|
||||
ctor:function(flip){
|
||||
_FlipX.prototype.ctor.call(this);
|
||||
this.initWithFlipX(flip);
|
||||
},
|
||||
|
||||
initWithFlipX:function (flip) {
|
||||
this._flippedX = !!flip;
|
||||
return true;
|
||||
},
|
||||
|
||||
update:function (dt) {
|
||||
var target = this.getTarget();
|
||||
target.scaleX = Math.abs(target.scaleX) * (this._flippedX ? -1 : 1);
|
||||
},
|
||||
|
||||
reverse:function () {
|
||||
return new cc.FlipX(!this._flippedX);
|
||||
},
|
||||
|
||||
clone:function(){
|
||||
return new cc.FlipX(this._flippedX);
|
||||
}
|
||||
});
|
||||
|
||||
cc.flipX = function (flip) {
|
||||
return new cc.FlipX(flip);
|
||||
};
|
||||
|
||||
var _FlipY = cc.FlipY;
|
||||
cc.FlipY = _FlipY.extend({
|
||||
_flippedY:false,
|
||||
|
||||
ctor: function(flip){
|
||||
_FlipY.prototype.ctor.call(this);
|
||||
this.initWithFlipY(flip);
|
||||
},
|
||||
|
||||
initWithFlipY:function (flip) {
|
||||
this._flippedY = !!flip;
|
||||
return true;
|
||||
},
|
||||
|
||||
update:function (dt) {
|
||||
var target = this.getTarget();
|
||||
target.scaleY = Math.abs(target.scaleY) * (this._flippedY ? -1 : 1);
|
||||
},
|
||||
|
||||
reverse:function () {
|
||||
return new cc.FlipY(!this._flippedY);
|
||||
},
|
||||
|
||||
clone:function(){
|
||||
return new cc.FlipY(this._flippedY);
|
||||
}
|
||||
});
|
||||
|
||||
cc.flipY = function (flip) {
|
||||
return new cc.FlipY(flip);
|
||||
};
|
||||
|
||||
function setRendererVisibility (sgNode, toggleVisible, visible) {
|
||||
if (!sgNode) { return; }
|
||||
var _renderComps = sgNode._owner.getComponentsInChildren(cc._SGComponent);
|
||||
|
||||
Reference in New Issue
Block a user