@@ -327,8 +327,8 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
327
327
_opacityModifyRGB :false ,
328
328
329
329
// 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.
332
332
333
333
_textureLoaded :false ,
334
334
_loadedEventListeners : null ,
@@ -761,23 +761,23 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
761
761
762
762
/**
763
763
* 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.
765
765
*/
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 ;
769
769
this . setTextureRect ( this . _rect , this . _rectRotated , this . _contentSize ) ;
770
770
this . setNodeDirty ( ) ;
771
771
}
772
772
} ,
773
773
774
774
/**
775
775
* 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.
777
777
*/
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 ;
781
781
this . setTextureRect ( this . _rect , this . _rectRotated , this . _contentSize ) ;
782
782
this . setNodeDirty ( ) ;
783
783
}
@@ -794,7 +794,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
794
794
* @return {Boolean } true if the sprite is flipped horizaontally, false otherwise.
795
795
*/
796
796
isFlippedX :function ( ) {
797
- return this . _flipX ;
797
+ return this . _flippedX ;
798
798
} ,
799
799
800
800
/**
@@ -808,7 +808,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
808
808
* @return {Boolean } true if the sprite is flipped vertically, flase otherwise.
809
809
*/
810
810
isFlippedY :function ( ) {
811
- return this . _flipY ;
811
+ return this . _flippedY ;
812
812
} ,
813
813
814
814
//
@@ -1023,7 +1023,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1023
1023
// update texture (calls _updateBlendFunc)
1024
1024
this . setTexture ( null ) ;
1025
1025
this . _textureLoaded = true ;
1026
- this . _flipX = this . _flipY = false ;
1026
+ this . _flippedX = this . _flippedY = false ;
1027
1027
1028
1028
// default transform anchor: center
1029
1029
this . setAnchorPoint ( cc . p ( 0.5 , 0.5 ) ) ;
@@ -1060,7 +1060,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1060
1060
// update texture (calls _updateBlendFunc)
1061
1061
this . setTexture ( null ) ;
1062
1062
this . _textureLoaded = true ;
1063
- this . _flipX = this . _flipY = false ;
1063
+ this . _flippedX = this . _flippedY = false ;
1064
1064
1065
1065
// default transform anchor: center
1066
1066
this . setAnchorPoint ( cc . p ( 0.5 , 0.5 ) ) ;
@@ -1137,7 +1137,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1137
1137
this . _blendFunc . src = cc . BLEND_SRC ;
1138
1138
this . _blendFunc . dst = cc . BLEND_DST ;
1139
1139
1140
- this . _flipX = this . _flipY = false ;
1140
+ this . _flippedX = this . _flippedY = false ;
1141
1141
1142
1142
// default transform anchor: center
1143
1143
this . setAnchorPoint ( cc . p ( 0.5 , 0.5 ) ) ;
@@ -1197,7 +1197,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1197
1197
this . _blendFunc . src = cc . BLEND_SRC ;
1198
1198
this . _blendFunc . dst = cc . BLEND_DST ;
1199
1199
1200
- this . _flipX = this . _flipY = false ;
1200
+ this . _flippedX = this . _flippedY = false ;
1201
1201
1202
1202
// default transform anchor: center
1203
1203
this . setAnchorPoint ( cc . p ( 0.5 , 0.5 ) ) ;
@@ -1290,9 +1290,9 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1290
1290
this . _setTextureCoords ( rect ) ;
1291
1291
1292
1292
var relativeOffset = this . _unflippedOffsetPositionFromCenter ;
1293
- if ( this . _flipX )
1293
+ if ( this . _flippedX )
1294
1294
relativeOffset . x = - relativeOffset . x ;
1295
- if ( this . _flipY )
1295
+ if ( this . _flippedY )
1296
1296
relativeOffset . y = - relativeOffset . y ;
1297
1297
1298
1298
var locRect = this . _rect ;
@@ -1331,9 +1331,9 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1331
1331
this . setVertexRect ( rect ) ;
1332
1332
1333
1333
var relativeOffset = this . _unflippedOffsetPositionFromCenter ;
1334
- if ( this . _flipX )
1334
+ if ( this . _flippedX )
1335
1335
relativeOffset . x = - relativeOffset . x ;
1336
- if ( this . _flipY )
1336
+ if ( this . _flippedY )
1337
1337
relativeOffset . y = - relativeOffset . y ;
1338
1338
this . _offsetPosition . x = relativeOffset . x + ( this . _contentSize . width - this . _rect . width ) / 2 ;
1339
1339
this . _offsetPosition . y = relativeOffset . y + ( this . _contentSize . height - this . _rect . height ) / 2 ;
@@ -1844,13 +1844,13 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1844
1844
bottom = ( rect . y + rect . width ) / atlasHeight ;
1845
1845
} // CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
1846
1846
1847
- if ( this . _flipX ) {
1847
+ if ( this . _flippedX ) {
1848
1848
tempSwap = top ;
1849
1849
top = bottom ;
1850
1850
bottom = tempSwap ;
1851
1851
}
1852
1852
1853
- if ( this . _flipY ) {
1853
+ if ( this . _flippedY ) {
1854
1854
tempSwap = left ;
1855
1855
left = right ;
1856
1856
right = tempSwap ;
@@ -1877,13 +1877,13 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1877
1877
bottom = ( rect . y + rect . height ) / atlasHeight ;
1878
1878
} // ! CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
1879
1879
1880
- if ( this . _flipX ) {
1880
+ if ( this . _flippedX ) {
1881
1881
tempSwap = left ;
1882
1882
left = right ;
1883
1883
right = tempSwap ;
1884
1884
}
1885
1885
1886
- if ( this . _flipY ) {
1886
+ if ( this . _flippedY ) {
1887
1887
tempSwap = top ;
1888
1888
top = bottom ;
1889
1889
bottom = tempSwap ;
@@ -1986,13 +1986,13 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
1986
1986
context . globalAlpha = this . _displayedOpacity / 255 ;
1987
1987
var locRect = this . _rect , locContentSize = this . _contentSize , locOffsetPosition = this . _offsetPosition ;
1988
1988
var flipXOffset = 0 | ( locOffsetPosition . x ) , flipYOffset = - locOffsetPosition . y - locRect . height ;
1989
- if ( this . _flipX || this . _flipY ) {
1989
+ if ( this . _flippedX || this . _flippedY ) {
1990
1990
context . save ( ) ;
1991
- if ( this . _flipX ) {
1991
+ if ( this . _flippedX ) {
1992
1992
flipXOffset = - locOffsetPosition . x - locRect . width ;
1993
1993
context . scale ( - 1 , 1 ) ;
1994
1994
}
1995
- if ( this . _flipY ) {
1995
+ if ( this . _flippedY ) {
1996
1996
flipYOffset = locOffsetPosition . y ;
1997
1997
context . scale ( 1 , - 1 ) ;
1998
1998
}
@@ -2031,7 +2031,7 @@ cc.Sprite = cc.NodeRGBA.extend(/** @lends cc.Sprite# */{
2031
2031
cc . p ( flipXOffset + drawSize . width , flipYOffset - drawSize . height ) , cc . p ( flipXOffset , flipYOffset - drawSize . height ) ] ;
2032
2032
cc . drawingUtil . drawPoly ( vertices2 , 4 , true ) ;
2033
2033
}
2034
- if ( this . _flipX || this . _flipY )
2034
+ if ( this . _flippedX || this . _flippedY )
2035
2035
context . restore ( ) ;
2036
2036
cc . g_NumberOfDraws ++ ;
2037
2037
}
0 commit comments