Skip to content

Commit 7a67b88

Browse files
committed
Issue #2803: cc.Sprite's setFlipX, setFlipY have renamed to setFlippedX, setFlippedY
1 parent 6c5b882 commit 7a67b88

File tree

8 files changed

+66
-66
lines changed

8 files changed

+66
-66
lines changed

cocos2d/actions/CCActionInstant.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -203,37 +203,37 @@ cc.RemoveSelf.create = function(isNeedCleanUp){
203203
* @extends cc.ActionInstant
204204
*/
205205
cc.FlipX = cc.ActionInstant.extend(/** @lends cc.FlipX# */{
206-
_flipX:false,
206+
_flippedX:false,
207207
ctor:function(){
208208
cc.FiniteTimeAction.prototype.ctor.call(this);
209-
this._flipX = false;
209+
this._flippedX = false;
210210
},
211211
/**
212212
* @param {Boolean} x
213213
* @return {Boolean}
214214
*/
215215
initWithFlipX:function (x) {
216-
this._flipX = x;
216+
this._flippedX = x;
217217
return true;
218218
},
219219

220220
/**
221221
* @param {Number} time
222222
*/
223223
update:function (time) {
224-
this._target.setFlipX(this._flipX);
224+
this._target.setFlippedX(this._flippedX);
225225
},
226226

227227
/**
228228
* @return {cc.FiniteTimeAction}
229229
*/
230230
reverse:function () {
231-
return cc.FlipX.create(!this._flipX);
231+
return cc.FlipX.create(!this._flippedX);
232232
},
233233

234234
clone:function(){
235235
var action = new cc.FlipX();
236-
action.initWithFlipX(this._flipX);
236+
action.initWithFlipX(this._flippedX);
237237
return action;
238238
}
239239
});
@@ -256,17 +256,17 @@ cc.FlipX.create = function (x) {
256256
* @extends cc.ActionInstant
257257
*/
258258
cc.FlipY = cc.ActionInstant.extend(/** @lends cc.FlipY# */{
259-
_flipY:false,
259+
_flippedY:false,
260260
ctor:function(){
261261
cc.FiniteTimeAction.prototype.ctor.call(this);
262-
this._flipY = false;
262+
this._flippedY = false;
263263
},
264264
/**
265265
* @param {Boolean} Y
266266
* @return {Boolean}
267267
*/
268268
initWithFlipY:function (Y) {
269-
this._flipY = Y;
269+
this._flippedY = Y;
270270
return true;
271271
},
272272

@@ -275,19 +275,19 @@ cc.FlipY = cc.ActionInstant.extend(/** @lends cc.FlipY# */{
275275
*/
276276
update:function (time) {
277277
//this._super();
278-
this._target.setFlipY(this._flipY);
278+
this._target.setFlippedY(this._flipY);
279279
},
280280

281281
/**
282282
* @return {cc.FiniteTimeAction}
283283
*/
284284
reverse:function () {
285-
return cc.FlipY.create(!this._flipY);
285+
return cc.FlipY.create(!this._flippedY);
286286
},
287287

288288
clone:function(){
289289
var action = new cc.FlipY();
290-
action.initWithFlipY(this._flipY);
290+
action.initWithFlipY(this._flippedY);
291291
return action;
292292
}
293293
});

cocos2d/layers_scenes_transitions_nodes/CCTransitionProgress.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ cc.TransitionProgressRadialCCW = cc.TransitionProgress.extend(/** @lends cc.Tran
136136

137137
// but it is flipped upside down so we flip the sprite
138138
if (cc.renderContextType === cc.WEBGL)
139-
pNode.getSprite().setFlipY(true);
139+
pNode.getSprite().setFlippedY(true);
140140
pNode.setType(cc.PROGRESS_TIMER_TYPE_RADIAL);
141141

142142
// Return the radial type that we want to use
@@ -178,7 +178,7 @@ cc.TransitionProgressRadialCW = cc.TransitionProgress.extend(/** @lends cc.Trans
178178

179179
// but it is flipped upside down so we flip the sprite
180180
if (cc.renderContextType === cc.WEBGL)
181-
pNode.getSprite().setFlipY(true);
181+
pNode.getSprite().setFlippedY(true);
182182
pNode.setType(cc.PROGRESS_TIMER_TYPE_RADIAL);
183183

184184
// Return the radial type that we want to use
@@ -219,8 +219,8 @@ cc.TransitionProgressHorizontal = cc.TransitionProgress.extend(/** @lends cc.Tra
219219
var pNode = cc.ProgressTimer.create(texture.getSprite());
220220

221221
// but it is flipped upside down so we flip the sprite
222-
if (cc.renderContextType == cc.WEBGL)
223-
pNode.getSprite().setFlipY(true);
222+
if (cc.renderContextType === cc.WEBGL)
223+
pNode.getSprite().setFlippedY(true);
224224
pNode.setType(cc.PROGRESS_TIMER_TYPE_BAR);
225225

226226
pNode.setMidpoint(cc.p(1, 0));
@@ -261,8 +261,8 @@ cc.TransitionProgressVertical = cc.TransitionProgress.extend(/** @lends cc.Trans
261261
var pNode = cc.ProgressTimer.create(texture.getSprite());
262262

263263
// but it is flipped upside down so we flip the sprite
264-
if (cc.renderContextType == cc.WEBGL)
265-
pNode.getSprite().setFlipY(true);
264+
if (cc.renderContextType === cc.WEBGL)
265+
pNode.getSprite().setFlippedY(true);
266266
pNode.setType(cc.PROGRESS_TIMER_TYPE_BAR);
267267

268268
pNode.setMidpoint(cc.p(0, 0));
@@ -302,8 +302,8 @@ cc.TransitionProgressInOut = cc.TransitionProgress.extend(/** @lends cc.Transiti
302302
var pNode = cc.ProgressTimer.create(texture.getSprite());
303303

304304
// but it is flipped upside down so we flip the sprite
305-
if (cc.renderContextType == cc.WEBGL)
306-
pNode.getSprite().setFlipY(true);
305+
if (cc.renderContextType === cc.WEBGL)
306+
pNode.getSprite().setFlippedY(true);
307307
pNode.setType(cc.PROGRESS_TIMER_TYPE_BAR);
308308

309309
pNode.setMidpoint(cc.p(0.5, 0.5));
@@ -351,8 +351,8 @@ cc.TransitionProgressOutIn = cc.TransitionProgress.extend(/** @lends cc.Transiti
351351
var pNode = cc.ProgressTimer.create(texture.getSprite());
352352

353353
// but it is flipped upside down so we flip the sprite
354-
if (cc.renderContextType == cc.WEBGL)
355-
pNode.getSprite().setFlipY(true);
354+
if (cc.renderContextType === cc.WEBGL)
355+
pNode.getSprite().setFlippedY(true);
356356
pNode.setType(cc.PROGRESS_TIMER_TYPE_BAR);
357357

358358
pNode.setMidpoint(cc.p(0.5, 0.5));

cocos2d/misc_nodes/CCProgressTimer.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -423,11 +423,11 @@ cc.ProgressTimer = cc.NodeRGBA.extend(/** @lends cc.ProgressTimer# */{
423423
var flipXOffset = 0 | (locOffsetPosition.x), flipYOffset = -locOffsetPosition.y - locRect.height;
424424

425425
context.save();
426-
if (locSprite._flipX) {
426+
if (locSprite._flippedX) {
427427
flipXOffset = -locOffsetPosition.x - locRect.width;
428428
context.scale(-1, 1);
429429
}
430-
if (locSprite._flipY) {
430+
if (locSprite._flippedY) {
431431
flipYOffset = locOffsetPosition.y;
432432
context.scale(1, -1);
433433
}
@@ -790,15 +790,15 @@ cc.ProgressTimer = cc.NodeRGBA.extend(/** @lends cc.ProgressTimer# */{
790790
locEndAngle = 270 + 3.6 * this._percentage;
791791
}
792792

793-
if (locSprite._flipX) {
793+
if (locSprite._flippedX) {
794794
locOrigin.x -= spriteSize.width * (this._midPoint.x * 2);
795795
locStartAngle= -locStartAngle;
796796
locEndAngle= -locEndAngle;
797797
locStartAngle -= 180;
798798
locEndAngle -= 180;
799799
locCounterClockWise = !locCounterClockWise;
800800
}
801-
if (locSprite._flipY) {
801+
if (locSprite._flippedY) {
802802
locOrigin.y+=spriteSize.height*(this._midPoint.y*2);
803803
locCounterClockWise = !locCounterClockWise;
804804
locStartAngle= -locStartAngle;
@@ -836,7 +836,7 @@ cc.ProgressTimer = cc.NodeRGBA.extend(/** @lends cc.ProgressTimer# */{
836836
//left pos
837837
locBarRect.x = 0;
838838
var flipXNeed = 1;
839-
if (locSprite._flipX) {
839+
if (locSprite._flippedX) {
840840
locBarRect.x -= currentDrawSize.width;
841841
flipXNeed = -1;
842842
}
@@ -847,7 +847,7 @@ cc.ProgressTimer = cc.NodeRGBA.extend(/** @lends cc.ProgressTimer# */{
847847
//right pos
848848
locBarRect.y = 0;
849849
var flipYNeed = 1;
850-
if (locSprite._flipY) {
850+
if (locSprite._flippedY) {
851851
locBarRect.y += currentDrawSize.height;
852852
flipYNeed = -1;
853853
}

cocos2d/sprite_nodes/CCSprite.js

+28-28
Original file line numberDiff line numberDiff line change
@@ -327,8 +327,8 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
327327
_opacityModifyRGB:false,
328328

329329
// image is flipped
330-
_flipX:false, //Whether the sprite is flipped horizontally or not.
331-
_flipY:false, //Whether the sprite is flipped vertically or not.
330+
_flippedX:false, //Whether the sprite is flipped horizontally or not.
331+
_flippedY:false, //Whether the sprite is flipped vertically or not.
332332

333333
_textureLoaded:false,
334334
_loadedEventListeners: null,
@@ -761,23 +761,23 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
761761

762762
/**
763763
* Sets whether the sprite should be flipped horizontally or not.
764-
* @param {Boolean} flipX true if the sprite should be flipped horizaontally, false otherwise.
764+
* @param {Boolean} flippedX true if the sprite should be flipped horizontally, false otherwise.
765765
*/
766-
setFlipX:function (flipX) {
767-
if (this._flipX != flipX) {
768-
this._flipX = flipX;
766+
setFlippedX:function (flippedX) {
767+
if (this._flippedX != flippedX) {
768+
this._flippedX = flippedX;
769769
this.setTextureRect(this._rect, this._rectRotated, this._contentSize);
770770
this.setNodeDirty();
771771
}
772772
},
773773

774774
/**
775775
* Sets whether the sprite should be flipped vertically or not.
776-
* @param {Boolean} flipY true if the sprite should be flipped vertically, flase otherwise.
776+
* @param {Boolean} flippedY true if the sprite should be flipped vertically, false otherwise.
777777
*/
778-
setFlipY:function (flipY) {
779-
if (this._flipY != flipY) {
780-
this._flipY = flipY;
778+
setFlippedY:function (flippedY) {
779+
if (this._flippedY != flippedY) {
780+
this._flippedY = flippedY;
781781
this.setTextureRect(this._rect, this._rectRotated, this._contentSize);
782782
this.setNodeDirty();
783783
}
@@ -794,7 +794,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
794794
* @return {Boolean} true if the sprite is flipped horizaontally, false otherwise.
795795
*/
796796
isFlippedX:function () {
797-
return this._flipX;
797+
return this._flippedX;
798798
},
799799

800800
/**
@@ -808,7 +808,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
808808
* @return {Boolean} true if the sprite is flipped vertically, flase otherwise.
809809
*/
810810
isFlippedY:function () {
811-
return this._flipY;
811+
return this._flippedY;
812812
},
813813

814814
//
@@ -1023,7 +1023,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
10231023
// update texture (calls _updateBlendFunc)
10241024
this.setTexture(null);
10251025
this._textureLoaded = true;
1026-
this._flipX = this._flipY = false;
1026+
this._flippedX = this._flippedY = false;
10271027

10281028
// default transform anchor: center
10291029
this.setAnchorPoint(cc.p(0.5, 0.5));
@@ -1060,7 +1060,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
10601060
// update texture (calls _updateBlendFunc)
10611061
this.setTexture(null);
10621062
this._textureLoaded = true;
1063-
this._flipX = this._flipY = false;
1063+
this._flippedX = this._flippedY = false;
10641064

10651065
// default transform anchor: center
10661066
this.setAnchorPoint(cc.p(0.5, 0.5));
@@ -1137,7 +1137,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
11371137
this._blendFunc.src = cc.BLEND_SRC;
11381138
this._blendFunc.dst = cc.BLEND_DST;
11391139

1140-
this._flipX = this._flipY = false;
1140+
this._flippedX = this._flippedY = false;
11411141

11421142
// default transform anchor: center
11431143
this.setAnchorPoint(cc.p(0.5, 0.5));
@@ -1197,7 +1197,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
11971197
this._blendFunc.src = cc.BLEND_SRC;
11981198
this._blendFunc.dst = cc.BLEND_DST;
11991199

1200-
this._flipX = this._flipY = false;
1200+
this._flippedX = this._flippedY = false;
12011201

12021202
// default transform anchor: center
12031203
this.setAnchorPoint(cc.p(0.5, 0.5));
@@ -1290,9 +1290,9 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
12901290
this._setTextureCoords(rect);
12911291

12921292
var relativeOffset = this._unflippedOffsetPositionFromCenter;
1293-
if (this._flipX)
1293+
if (this._flippedX)
12941294
relativeOffset.x = -relativeOffset.x;
1295-
if (this._flipY)
1295+
if (this._flippedY)
12961296
relativeOffset.y = -relativeOffset.y;
12971297

12981298
var locRect = this._rect;
@@ -1331,9 +1331,9 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
13311331
this.setVertexRect(rect);
13321332

13331333
var relativeOffset = this._unflippedOffsetPositionFromCenter;
1334-
if (this._flipX)
1334+
if (this._flippedX)
13351335
relativeOffset.x = -relativeOffset.x;
1336-
if (this._flipY)
1336+
if (this._flippedY)
13371337
relativeOffset.y = -relativeOffset.y;
13381338
this._offsetPosition.x = relativeOffset.x + (this._contentSize.width - this._rect.width) / 2;
13391339
this._offsetPosition.y = relativeOffset.y + (this._contentSize.height - this._rect.height) / 2;
@@ -1844,13 +1844,13 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
18441844
bottom = (rect.y + rect.width) / atlasHeight;
18451845
}// CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
18461846

1847-
if (this._flipX) {
1847+
if (this._flippedX) {
18481848
tempSwap = top;
18491849
top = bottom;
18501850
bottom = tempSwap;
18511851
}
18521852

1853-
if (this._flipY) {
1853+
if (this._flippedY) {
18541854
tempSwap = left;
18551855
left = right;
18561856
right = tempSwap;
@@ -1877,13 +1877,13 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
18771877
bottom = (rect.y + rect.height) / atlasHeight;
18781878
} // ! CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
18791879

1880-
if (this._flipX) {
1880+
if (this._flippedX) {
18811881
tempSwap = left;
18821882
left = right;
18831883
right = tempSwap;
18841884
}
18851885

1886-
if (this._flipY) {
1886+
if (this._flippedY) {
18871887
tempSwap = top;
18881888
top = bottom;
18891889
bottom = tempSwap;
@@ -1986,13 +1986,13 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
19861986
context.globalAlpha = this._displayedOpacity / 255;
19871987
var locRect = this._rect, locContentSize = this._contentSize, locOffsetPosition = this._offsetPosition;
19881988
var flipXOffset = 0 | (locOffsetPosition.x), flipYOffset = -locOffsetPosition.y - locRect.height;
1989-
if (this._flipX || this._flipY) {
1989+
if (this._flippedX || this._flippedY) {
19901990
context.save();
1991-
if (this._flipX) {
1991+
if (this._flippedX) {
19921992
flipXOffset = -locOffsetPosition.x - locRect.width;
19931993
context.scale(-1, 1);
19941994
}
1995-
if (this._flipY) {
1995+
if (this._flippedY) {
19961996
flipYOffset = locOffsetPosition.y;
19971997
context.scale(1, -1);
19981998
}
@@ -2031,7 +2031,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
20312031
cc.p(flipXOffset + drawSize.width, flipYOffset - drawSize.height), cc.p(flipXOffset, flipYOffset - drawSize.height)];
20322032
cc.drawingUtil.drawPoly(vertices2, 4, true);
20332033
}
2034-
if (this._flipX || this._flipY)
2034+
if (this._flippedX || this._flippedY)
20352035
context.restore();
20362036
cc.g_NumberOfDraws++;
20372037
}

0 commit comments

Comments
 (0)