Skip to content

Commit 9268fcb

Browse files
committed
Renamed addX to incX (etc) in Layer to avoid clashing with the addition of children.
1 parent ab99951 commit 9268fcb

6 files changed

Lines changed: 49 additions & 25 deletions

File tree

v3/src/gameobjects/layer/Layer.js

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,31 @@
11

22
var Class = require('../../utils/Class');
33
var Set = require('../../structs/Set');
4+
var Actions = require('./actions/');
45

56
var Layer = new Class({
67

8+
Mixins: [
9+
Actions.IncX,
10+
Actions.IncY,
11+
Actions.IncXY,
12+
Actions.SetX,
13+
Actions.SetY,
14+
Actions.SetXY,
15+
Actions.Rotate,
16+
Actions.Angle,
17+
Actions.SetRotation,
18+
Actions.SetVisible,
19+
Actions.ToggleVisible,
20+
Actions.Align
21+
],
22+
723
initialize:
824

9-
function Layer (children)
25+
function Layer (state, children)
1026
{
27+
this.state = state;
28+
1129
this.children = new Set(children);
1230
},
1331

@@ -47,23 +65,13 @@ var Layer = new Class({
4765
return this;
4866
},
4967

50-
// Child Update Methods
51-
52-
addX: require('./actions/AddX'),
53-
addY: require('./actions/AddY'),
54-
addXY: require('./actions/AddXY'),
55-
setX: require('./actions/SetX'),
56-
setY: require('./actions/SetY'),
57-
setXY: require('./actions/SetXY'),
58-
59-
rotate: require('./actions/Rotate'),
60-
angle: require('./actions/Angle'),
61-
setRotation: require('./actions/SetRotation'),
62-
setVisible: require('./actions/SetVisible'),
63-
toggleVisible: require('./actions/ToggleVisible'),
64-
65-
align: require('./actions/Align')
68+
destroy: function ()
69+
{
70+
this.children.clear();
6671

72+
this.state = undefined;
73+
this.children = undefined;
74+
}
6775
});
6876

6977
module.exports = Layer;

v3/src/gameobjects/layer/LayerFactory.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ var LayerFactory = {
77

88
add: function (children)
99
{
10-
return new Layer(children);
10+
return new Layer(this.state, children);
1111
},
1212

1313
make: function (children)
1414
{
15-
return new Layer(children);
15+
return new Layer(this.state, children);
1616
}
1717

1818
};
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var AddX = function (value)
1+
var IncX = function (value)
22
{
33
var children = this.children.entries;
44

@@ -10,4 +10,4 @@ var AddX = function (value)
1010
return this;
1111
};
1212

13-
module.exports = AddX;
13+
module.exports = IncX;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var AddXY = function (x, y)
1+
var IncXY = function (x, y)
22
{
33
var children = this.children.entries;
44

@@ -11,4 +11,4 @@ var AddXY = function (x, y)
1111
return this;
1212
};
1313

14-
module.exports = AddXY;
14+
module.exports = IncXY;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var AddY = function (value)
1+
var IncY = function (value)
22
{
33
var children = this.children.entries;
44

@@ -10,4 +10,4 @@ var AddY = function (value)
1010
return this;
1111
};
1212

13-
module.exports = AddY;
13+
module.exports = IncY;
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module.exports = {
2+
3+
IncX: require('./IncX'),
4+
IncXY: require('./IncXY'),
5+
IncY: require('./IncY'),
6+
Align: require('./Align'),
7+
Angle: require('./Angle'),
8+
Rotate: require('./Rotate'),
9+
SetRotation: require('./SetRotation'),
10+
SetVisible: require('./SetVisible'),
11+
SetX: require('./SetX'),
12+
SetXY: require('./SetXY'),
13+
SetY: require('./SetY'),
14+
ToggleVisible: require('./ToggleVisible')
15+
16+
};

0 commit comments

Comments
 (0)