Skip to content

Commit 42d2cfd

Browse files
committed
Merge branch 'master' of https://github.com/photonstorm/phaser
2 parents f500e82 + af212a1 commit 42d2cfd

7 files changed

Lines changed: 26 additions & 16 deletions

File tree

src/input/keyboard/KeyboardManager.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -362,13 +362,13 @@ var KeyboardManager = new Class({
362362
var event = queue[i];
363363
var code = event.keyCode;
364364

365-
// Will emit a keyboard or keyup event
366-
this.emit(event.type, event);
367-
368365
if (event.type === 'keydown')
369366
{
370-
if (KeyMap[code])
367+
if (KeyMap[code] && (keys[code] === undefined || keys[code].isDown === false))
371368
{
369+
// Will emit a keyboard or keyup event
370+
this.emit(event.type, event);
371+
372372
this.emit('keydown_' + KeyMap[code], event);
373373
}
374374

@@ -379,6 +379,9 @@ var KeyboardManager = new Class({
379379
}
380380
else
381381
{
382+
// Will emit a keyboard or keyup event
383+
this.emit(event.type, event);
384+
382385
this.emit('keyup_' + KeyMap[code], event);
383386

384387
if (keys[code])

src/input/keyboard/keys/ProcessKeyDown.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,14 @@ var ProcessKeyDown = function (key, event)
3434
key.shiftKey = event.shiftKey;
3535
key.location = event.location;
3636

37-
key.isDown = true;
38-
key.isUp = false;
39-
key.timeDown = event.timeStamp;
40-
key.duration = 0;
37+
if (key.isDown === false)
38+
{
39+
key.isDown = true;
40+
key.isUp = false;
41+
key.timeDown = event.timeStamp;
42+
key.duration = 0;
43+
}
44+
4145
key.repeats++;
4246

4347
key._justDown = true;

src/loader/LoaderPlugin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,7 @@ var LoaderPlugin = new Class({
656656
// Yup, add them to the Texture Manager
657657

658658
// Is the data JSON Hash or JSON Array?
659-
if (Array.isArray(data[0].frames))
659+
if (Array.isArray(data[0].textures) || Array.isArray(data[0].frames))
660660
{
661661
textures.addAtlasJSONArray(key, images, data);
662662
}

src/math/random-data-generator/RandomDataGenerator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ var RandomDataGenerator = new Class({
8585
* @type {array}
8686
* @since 3.0.0
8787
*/
88-
this.sign = [ -1, 1 ];
88+
this.signs = [ -1, 1 ];
8989

9090
if (seeds)
9191
{
@@ -171,7 +171,7 @@ var RandomDataGenerator = new Class({
171171

172172
/**
173173
* Reset the seed of the random data generator.
174-
*
174+
*
175175
* _Note_: the seed array is only processed up to the first `undefined` (or `null`) value, should such be present.
176176
*
177177
* @method Phaser.Math.RandomDataGenerator#sow
@@ -356,7 +356,7 @@ var RandomDataGenerator = new Class({
356356
*/
357357
sign: function ()
358358
{
359-
return this.pick(this.sign);
359+
return this.pick(this.signs);
360360
},
361361

362362
/**

src/physics/arcade/World.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,10 +1364,11 @@ var World = new Class({
13641364
*/
13651365
collideHandler: function (object1, object2, collideCallback, processCallback, callbackContext, overlapOnly)
13661366
{
1367+
// Collide Group with Self
13671368
// Only collide valid objects
13681369
if (object2 === undefined && object1.isParent)
13691370
{
1370-
return this.collideGroupVsSelf(object1, collideCallback, processCallback, callbackContext, overlapOnly);
1371+
return this.collideGroupVsGroup(object1, object1, collideCallback, processCallback, callbackContext, overlapOnly);
13711372
}
13721373

13731374
// If neither of the objects are set then bail out

src/textures/TextureManager.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,9 +314,11 @@ var TextureManager = new Class({
314314

315315
if (Array.isArray(data))
316316
{
317-
for (var i = 0; i < data.length; i++)
317+
var singleAtlasFile = (data.length === 1); // multi-pack with one atlas file for all images
318+
for (var i = 0; i < texture.source.length; i++)
318319
{
319-
Parser.JSONArray(texture, i, data[i]);
320+
var atlasData = singleAtlasFile ? data[0] : data[i];
321+
Parser.JSONArray(texture, i, atlasData);
320322
}
321323
}
322324
else

src/textures/parsers/JSONArray.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ var JSONArray = function (texture, sourceIndex, json)
3434
texture.add('__BASE', sourceIndex, 0, 0, source.width, source.height);
3535

3636
// By this stage frames is a fully parsed array
37-
var frames = (Array.isArray(json.textures)) ? json.textures[0].frames : json.frames;
37+
var frames = (Array.isArray(json.textures)) ? json.textures[sourceIndex].frames : json.frames;
3838

3939
var newFrame;
4040

0 commit comments

Comments
 (0)