Skip to content

Commit 14881bb

Browse files
committed
Renamed data to geom to avoid DataManager clash. Added preDestroy.
1 parent 4ba3b37 commit 14881bb

8 files changed

Lines changed: 35 additions & 20 deletions

File tree

src/gameobjects/shape/Shape.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ var Shape = new Class({
7272
* @readonly
7373
* @since 3.13.0
7474
*/
75-
this.data = data;
75+
this.geom = data;
7676

7777
/**
7878
* Holds the polygon path data for filled rendering.
@@ -272,6 +272,21 @@ var Shape = new Class({
272272
this.closePath = value;
273273

274274
return this;
275+
},
276+
277+
/**
278+
* Internal destroy handler, called as part of the destroy process.
279+
*
280+
* @method Phaser.GameObjects.Shape#preDestroy
281+
* @protected
282+
* @since 3.13.0
283+
*/
284+
preDestroy: function ()
285+
{
286+
this.geom = null;
287+
this._tempLine = null;
288+
this.pathData = [];
289+
this.pathIndexes = [];
275290
}
276291

277292
});

src/gameobjects/shape/arc/Arc.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ var Arc = new Class({
9494
this._iterations = 0.01;
9595

9696
this.setPosition(x, y);
97-
this.setSize(this.data.radius, this.data.radius);
97+
this.setSize(this.geom.radius, this.geom.radius);
9898

9999
if (fillColor !== undefined)
100100
{
@@ -142,12 +142,12 @@ var Arc = new Class({
142142

143143
get: function ()
144144
{
145-
return this.data.radius;
145+
return this.geom.radius;
146146
},
147147

148148
set: function (value)
149149
{
150-
this.data.radius = value;
150+
this.geom.radius = value;
151151

152152
this.updateData();
153153
}
@@ -323,7 +323,7 @@ var Arc = new Class({
323323
var step = this._iterations;
324324
var iteration = step;
325325

326-
var radius = this.data.radius;
326+
var radius = this.geom.radius;
327327
var startAngle = DegToRad(this._startAngle);
328328
var endAngle = DegToRad(this._endAngle);
329329
var anticlockwise = this._anticlockwise;

src/gameobjects/shape/curve/Curve.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,13 @@ var Curve = new Class({
136136
var smoothness = this._smoothness;
137137

138138
// Update the bounds in case the underlying data has changed
139-
this.data.getBounds(bounds, smoothness);
139+
this.geom.getBounds(bounds, smoothness);
140140

141141
this.setSize(bounds.width, bounds.height);
142142
this.updateDisplayOrigin();
143143

144144
var path = [];
145-
var points = this.data.getPoints(smoothness);
145+
var points = this.geom.getPoints(smoothness);
146146

147147
for (var i = 0; i < points.length; i++)
148148
{

src/gameobjects/shape/ellipse/Ellipse.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ var Ellipse = new Class({
108108
*/
109109
setSize: function (width, height)
110110
{
111-
this.data.setSize(width, height);
111+
this.geom.setSize(width, height);
112112

113113
return this.updateData();
114114
},
@@ -144,7 +144,7 @@ var Ellipse = new Class({
144144
updateData: function ()
145145
{
146146
var path = [];
147-
var points = this.data.getPoints(this._smoothness);
147+
var points = this.geom.getPoints(this._smoothness);
148148

149149
for (var i = 0; i < points.length; i++)
150150
{

src/gameobjects/shape/line/Line.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ var Line = new Class({
4949

5050
Shape.call(this, scene, 'Line', new GeomLine(x1, y1, x2, y2));
5151

52-
var width = this.data.right - this.data.left;
53-
var height = this.data.bottom - this.data.top;
52+
var width = this.geom.right - this.geom.left;
53+
var height = this.geom.bottom - this.geom.top;
5454

5555
/**
5656
* Private internal value. Holds the start width of the line.
@@ -126,7 +126,7 @@ var Line = new Class({
126126
*/
127127
setTo: function (x1, y1, x2, y2)
128128
{
129-
this.data.setTo(x1, y1, x2, y2);
129+
this.geom.setTo(x1, y1, x2, y2);
130130

131131
return this;
132132
}

src/gameobjects/shape/polygon/Polygon.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ var Polygon = new Class({
4545

4646
Shape.call(this, scene, 'Polygon', new GeomPolygon(points));
4747

48-
var bounds = GetAABB(this.data);
48+
var bounds = GetAABB(this.geom);
4949

5050
this.setPosition(x, y);
5151
this.setSize(bounds.width, bounds.height);
@@ -77,7 +77,7 @@ var Polygon = new Class({
7777

7878
for (var i = 0; i < iterations; i++)
7979
{
80-
Smooth(this.data);
80+
Smooth(this.geom);
8181
}
8282

8383
return this.updateData();
@@ -95,7 +95,7 @@ var Polygon = new Class({
9595
updateData: function ()
9696
{
9797
var path = [];
98-
var points = this.data.points;
98+
var points = this.geom.points;
9999

100100
for (var i = 0; i < points.length; i++)
101101
{

src/gameobjects/shape/rectangle/Rectangle.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ var Rectangle = new Class({
6969
updateData: function ()
7070
{
7171
var path = [];
72-
var rect = this.data;
72+
var rect = this.geom;
7373
var line = this._tempLine;
7474

7575
rect.getLineA(line);

src/gameobjects/shape/triangle/Triangle.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ var Triangle = new Class({
5353

5454
Shape.call(this, scene, 'Triangle', new GeomTriangle(x1, y1, x2, y2, x3, y3));
5555

56-
var width = this.data.right - this.data.left;
57-
var height = this.data.bottom - this.data.top;
56+
var width = this.geom.right - this.geom.left;
57+
var height = this.geom.bottom - this.geom.top;
5858

5959
this.setPosition(x, y);
6060
this.setSize(width, height);
@@ -85,7 +85,7 @@ var Triangle = new Class({
8585
*/
8686
setTo: function (x1, y1, x2, y2, x3, y3)
8787
{
88-
this.data.setTo(x1, y1, x2, y2, x3, y3);
88+
this.geom.setTo(x1, y1, x2, y2, x3, y3);
8989

9090
return this.updateData();
9191
},
@@ -102,7 +102,7 @@ var Triangle = new Class({
102102
updateData: function ()
103103
{
104104
var path = [];
105-
var rect = this.data;
105+
var rect = this.geom;
106106
var line = this._tempLine;
107107

108108
rect.getLineA(line);

0 commit comments

Comments
 (0)