Skip to content

Commit 57a9099

Browse files
committed
Tidied up Class, fixed a few bounds checks and exposed the utils.
1 parent 717a232 commit 57a9099

9 files changed

Lines changed: 14 additions & 185 deletions

File tree

v3/src/checksum.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
var CHECKSUM = {
2-
build: '55224080-fa4e-11e6-841c-31e712585627'
2+
build: '9fe3a260-fd52-11e6-a8e7-7b6917f97568'
33
};
44
module.exports = CHECKSUM;

v3/src/components/Bounds.js

Lines changed: 0 additions & 55 deletions
This file was deleted.

v3/src/components/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ module.exports = {
22

33
Alpha: require('./Alpha'),
44
BlendMode: require('./BlendMode'),
5-
Bounds: require('./Bounds'),
65
Children: require('./Children'),
76
Color: require('./Color'),
87
Data: require('./Data'),

v3/src/gameobjects/image/Image.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ var Image = new Class({
99
Mixins: [
1010
Components.Alpha,
1111
Components.BlendMode,
12-
Components.Bounds,
1312
Components.GetBounds,
1413
Components.ScaleMode,
1514
Components.Size,

v3/src/loader/BaseLoader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ BaseLoader.prototype = {
6767

6868
start: function ()
6969
{
70-
console.log(this.state.settings.key, ' - BaseLoader start. Files to load:', this.list.size);
70+
console.log(this.state.settings.key, '- BaseLoader start. Files to load:', this.list.size);
7171

7272
if (!this.isReady())
7373
{
@@ -247,7 +247,7 @@ BaseLoader.prototype = {
247247

248248
processComplete: function ()
249249
{
250-
console.log(this.state.settings.key, ' - Loader Complete. Loaded:', this.storage.size, 'Failed:', this.failed.size);
250+
console.log(this.state.settings.key, '- Loader Complete. Loaded:', this.storage.size, 'Failed:', this.failed.size);
251251

252252
this.list.clear();
253253
this.inflight.clear();

v3/src/phaser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@ var Phaser = {
4040

4141
Utils: {
4242

43+
Align: require('./utils/align/'),
4344
Array: require('./utils/array/'),
45+
Bounds: require('./utils/bounds/'),
4446
Objects: require('./utils/object/'),
4547
String: require('./utils/string/')
4648

v3/src/utils/Class.js

Lines changed: 5 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function getProperty (definition, k, isClassDescriptor)
1717
def = def.value;
1818
}
1919

20-
// This might be a regular property, or it may be a getter / setter the user defined in a class.
20+
// This might be a regular property, or it may be a getter/setter the user defined in a class.
2121
if (def && hasGetterOrSetter(def))
2222
{
2323
if (typeof def.enumerable === 'undefined')
@@ -34,14 +34,7 @@ function getProperty (definition, k, isClassDescriptor)
3434
}
3535
else
3636
{
37-
// if (typeof definition[k] === 'object')
38-
// {
39-
// return -1;
40-
// }
41-
// else
42-
// {
43-
return false;
44-
// }
37+
return false;
4538
}
4639
}
4740

@@ -67,7 +60,7 @@ function hasNonConfigurable (obj, k)
6760
return false;
6861
}
6962

70-
function extend (ctor, definition, isClassDescriptor, extendCallback)
63+
function extend (ctor, definition, isClassDescriptor, extend)
7164
{
7265
for (var k in definition)
7366
{
@@ -76,78 +69,13 @@ function extend (ctor, definition, isClassDescriptor, extendCallback)
7669
continue;
7770
}
7871

79-
if (typeof definition[k] === 'object')
80-
{
81-
// Here goes nothing ...
82-
extend(ctor, def, false, extendCallback);
83-
}
84-
8572
var def = getProperty(definition, k, isClassDescriptor);
8673

87-
// Object ...
88-
89-
if (def === -1)
90-
{
91-
console.log(k, def);
92-
93-
// Iterate the object, and see if any children are getters / setters
94-
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/defineProperty
95-
96-
def = definition[k];
97-
98-
var entry = {};
99-
100-
entry[k] = {};
101-
102-
// ctor.prototype[k] = {};
103-
// Object.defineProperty(ctor.prototype, k, { value: {} });
104-
105-
console.log('iterating', def);
106-
107-
for (var key in def)
108-
{
109-
var child = def[key];
110-
111-
console.log('->', key, child);
112-
113-
if (child && hasGetterOrSetter(child))
114-
{
115-
if (typeof child.enumerable === 'undefined')
116-
{
117-
child.enumerable = true;
118-
}
119-
120-
if (typeof child.configurable === 'undefined')
121-
{
122-
child.configurable = true;
123-
}
124-
125-
Object.defineProperty(entry[k], key, child);
126-
}
127-
else
128-
{
129-
Object.defineProperty(entry[k], key, {
130-
value: child,
131-
writable: true,
132-
configurable: true,
133-
enumerable: true
134-
});
135-
136-
// ctor.prototype[k][key] = { value: child };
137-
}
138-
}
139-
140-
// ctor.prototype[k] = def;
141-
142-
console.dir(entry);
143-
144-
Object.defineProperties(ctor.prototype, entry);
145-
}
146-
else if (def !== false)
74+
if (def !== false)
14775
{
14876
// If Extends is used, we will check its prototype to see if the final variable exists.
14977

150-
var parent = extendCallback || ctor;
78+
var parent = extend || ctor;
15179

15280
if (hasNonConfigurable(parent.prototype, k))
15381
{
@@ -176,8 +104,6 @@ function extend (ctor, definition, isClassDescriptor, extendCallback)
176104

177105
function mixin (myClass, mixins)
178106
{
179-
console.log(myClass);
180-
181107
if (!mixins)
182108
{
183109
return;

v3/src/utils/GetObjectValue.js

Lines changed: 0 additions & 37 deletions
This file was deleted.

v3/src/utils/bounds/CenterOn.js

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
var CenterX = require('./CenterX');
2-
var CenterY = require('./CenterY');
1+
var SetCenterX = require('./SetCenterX');
2+
var SetCenterY = require('./SetCenterY');
33

44
/**
55
* The center x coordinate of the Game Object.
@@ -8,16 +8,11 @@ var CenterY = require('./CenterY');
88
* @property {number} centerX
99
*/
1010

11-
// Phaser.Utils.Bounds.GetCenterX(bob)
12-
// Phaser.Utils.Bounds.CenterOn(bob, x, y)
13-
// Phaser.Utils.Bounds.CenterX(bob, x)
14-
// Phaser.Utils.Bounds.CenterY(bob, x)
15-
1611
var CenterOn = function (gameObject, x, y)
1712
{
18-
CenterX(gameObject, x);
13+
SetCenterX(gameObject, x);
1914

20-
return CenterY(gameObject, y);
15+
return SetCenterY(gameObject, y);
2116
};
2217

2318
module.exports = CenterOn;

0 commit comments

Comments
 (0)