File tree Expand file tree Collapse file tree
src/gameobjects/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -95,6 +95,42 @@ var Transform = {
9595 */
9696 w : 0 ,
9797
98+ /**
99+ * This is a special setter that allows you to set both the horizontal and vertical scale of this Game Object
100+ * to the same value, at the same time. When reading this value the result returned is `(scaleX + scaleY) / 2`.
101+ *
102+ * Use of this property implies you wish the horizontal and vertical scales to be equal to each other. If this
103+ * isn't the case, use the `scaleX` or `scaleY` properties instead.
104+ *
105+ * @name Phaser.GameObjects.Components.Transform#scale
106+ * @type {number }
107+ * @default 1
108+ * @since 3.18.0
109+ */
110+ scale : {
111+
112+ get : function ( )
113+ {
114+ return ( this . _scaleX + this . _scaleY ) / 2 ;
115+ } ,
116+
117+ set : function ( value )
118+ {
119+ this . _scaleX = value ;
120+ this . _scaleY = value ;
121+
122+ if ( value === 0 )
123+ {
124+ this . renderFlags &= ~ _FLAG ;
125+ }
126+ else
127+ {
128+ this . renderFlags |= _FLAG ;
129+ }
130+ }
131+
132+ } ,
133+
98134 /**
99135 * The horizontal scale of this Game Object.
100136 *
@@ -114,7 +150,7 @@ var Transform = {
114150 {
115151 this . _scaleX = value ;
116152
117- if ( this . _scaleX === 0 )
153+ if ( value === 0 )
118154 {
119155 this . renderFlags &= ~ _FLAG ;
120156 }
@@ -145,7 +181,7 @@ var Transform = {
145181 {
146182 this . _scaleY = value ;
147183
148- if ( this . _scaleY === 0 )
184+ if ( value === 0 )
149185 {
150186 this . renderFlags &= ~ _FLAG ;
151187 }
You can’t perform that action at this time.
0 commit comments