8000 Merge branch 'dev' into texture-compression-webgl · ITCSsDeveloper/phaser@b84e6ef · GitHub
Skip to content

Commit b84e6ef

Browse files
committed
Merge branch 'dev' into texture-compression-webgl
2 parents ce9e9fb + a41f62a commit b84e6ef

6 files changed

Lines changed: 26 additions & 51 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,14 +331,15 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
331331
* Phaser.Tileset has a new property `lastgid` which is populated automatically by the TilemapParser when importing Tiled map data, or can be set manually if building your own tileset.
332332
* Stage will now check if `document.hidden` is available first, and if it is then never even check for the prefixed versions. This stops warnings like "mozHidden and mozVisibilityState are deprecated" in newer versions of browsers and retain backward compatibility (thanks @leopoldobrines7 #2656)
333333
* As a result of changes in #2573 Graphics objects were calling `updateLocalBounds` on any shape change, which could cause dramatic performances drops in Graphics heavy situations (#2618). Graphics objects now have a new flag `_boundsDirty` which is used to detect if the bounds have been invalidated, i.e. by a Graphics being cleared or drawn to. If this is set to true then `updateLocalBounds` is called once in the `postUpdate` method (thanks @pengchuan #2618)
334-
334+
* Phaser.Image now has the ScaleMinMax component.
335335

336336
### Bug Fixes
337337

338338
* A Group with `inputEnableChildren` set would re-start the Input Handler on a Sprite, even if that handler had been disabled previously.
339339
* Weapon.autofire wouldn't fire after the first bullet, or until `fire` was called, neither of which are requirements. If you now set this boolean the Weapon will fire continuously until you toggle it back to false (thanks @alverLopez #2647)
340340
* ArcadePhysics.World.angleBetweenCenters now uses `centerX` and `centerY` properties to check for the angle between, instead of `center.x/y` as that property no longer exists (thanks @leopoldobrines7 #2654)
341341
* The Emitter.makeParticles `collide` argument didn't work, as a result of #2661, but is now properly respected thanks to that change (thanks @samme #2662)
342+
* Sound.play would throw the error "Uncaught DOMException: Failed to execute 'disconnect' on 'AudioNode': the given destination is not connected." in Chrome, if you tried to play an audio marker that didn't exist, while a valid marker was already playing.
342343

343344
### Pixi Updates
344345

src/core/Group.js

Lines changed: 12 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,25 +2711,20 @@ Object.defineProperty(Phaser.Group.prototype, "angle", {
27112711
* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
27122712
* visible children.
27132713
*
2714-
* Note that no ancestors are factored into the result, meaning that if this Group is
2715-
* nested within another Group, with heavy transforms on it, the result of this property
2716-
* is likely to be incorrect. It is safe to get and set this property if the Group is a
2717-
* top-level descendant of Phaser.World, or untransformed parents.
2718-
*
27192714
* @name Phaser.Group#centerX
27202715
* @property {number} centerX
27212716
*/
27222717
Object.defineProperty(Phaser.Group.prototype, "centerX", {
27232718

27242719
get: function () {
27252720

2726-
return this.getBounds().centerX;
2721+
return this.getBounds(this.parent).centerX;
27272722

27282723
},
27292724

27302725
set: function (value) {
27312726

2732-
var r = this.getBounds();
2727+
var r = this.getBounds(this.parent);
27332728
var offset = this.x - r.x;
27342729

27352730
this.x = (value + offset) - r.halfWidth;
@@ -2744,25 +2739,20 @@ Object.defineProperty(Phaser.Group.prototype, "centerX", {
27442739
* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
27452740
* visible children.
27462741
*
2747-
* Note that no ancestors are factored into the result, meaning that if this Group is
2748-
* nested within another Group, with heavy transforms on it, the result of this property
2749-
* is likely to be incorrect. It is safe to get and set this property if the Group is a
2750-
* top-level descendant of Phaser.World, or untransformed parents.
2751-
*
27522742
* @name Phaser.Group#centerY
27532743
* @property {number} centerY
27542744
*/
27552745
Object.defineProperty(Phaser.Group.prototype, "centerY", {
27562746

27572747
get: function () {
27582748

2759-
return this.getBounds().centerY;
2749+
return this.getBounds(this.parent).centerY;
27602750

27612751
},
27622752

27632753
set: function (value) {
27642754

2765-
var r = this.getBounds();
2755+
var r = this.getBounds(this.parent);
27662756
var offset = this.y - r.y;
27672757

27682758
this.y = (value + offset) - r.halfHeight;
@@ -2777,25 +2767,20 @@ Object.defineProperty(Phaser.Group.prototype, "centerY", {
27772767
* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
27782768
* visible children.
27792769
*
2780-
* Note that no ancestors are factored into the result, meaning that if this Group is
2781-
* nested within another Group, with heavy transforms on it, the result of this property
2782-
* is likely to be incorrect. It is safe to get and set this property if the Group is a
2783-
* top-level descendant of Phaser.World, or untransformed parents.
2784-
*
27852770
* @name Phaser.Group#left
27862771
* @property {number} left
27872772
*/
27882773
Object.defineProperty(Phaser.Group.prototype, "left", {
27892774

27902775
get: function () {
27912776

2792-
return this.getBounds().left;
2777+
return this.getBounds(this.parent).left;
27932778

27942779
},
27952780

27962781
set: function (value) {
27972782

2798-
var r = this.getBounds();
2783+
var r = this.getBounds(this.parent);
27992784
var offset = this.x - r.x;
28002785

28012786
this.x = value + offset;
@@ -2809,11 +2794,6 @@ Object.defineProperty(Phaser.Group.prototype, "left", {
28092794
*
28102795
* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
28112796
* visible children.
2812-
*
2813-
* Note that no ancestors are factored into the result, meaning that if this Group is
2814-
* nested within another Group, with heavy transforms on it, the result of this property
2815-
* is likely to be incorrect. It is safe to get and set this property if the Group is a
2816-
* top-level descendant of Phaser.World, or untransformed parents.
28172797
*
28182798
* @name Phaser.Group#right
28192799
* @property {number} right
@@ -2822,13 +2802,13 @@ Object.defineProperty(Phaser.Group.prototype, "right", {
28222802

28232803
get: function () {
28242804

2825-
return this.getBounds().right;
2805+
return this.getBounds(this.parent).right;
28262806

28272807
},
28282808

28292809
set: function (value) {
28302810

2831-
var r = this.getBounds();
2811+
var r = this.getBounds(this.parent);
28322812
var offset = this.x - r.x;
28332813

28342814
this.x = (value + offset) - r.width;
@@ -2842,11 +2822,6 @@ Object.defineProperty(Phaser.Group.prototype, "right", {
28422822
*
28432823
* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
28442824
* visible children.
2845-
*
2846-
* Note that no ancestors are factored into the result, meaning that if this Group is
2847-
* nested within another Group, with heavy transforms on it, the result of this property
2848-
* is likely to be incorrect. It is safe to get and set this property if the Group is a
2849-
* top-level descendant of Phaser.World, or untransformed parents.
28502825
*
28512826
* @name Phaser.Group#top
28522827
* @property {number} top
@@ -2855,13 +2830,13 @@ Object.defineProperty(Phaser.Group.prototype, "top", {
28552830

28562831
get: function () {
28572832

2858-
return this.getBounds().top;
2833+
return this.getBounds(this.parent).top;
28592834

28602835
},
28612836

28622837
set: function (value) {
28632838

2864-
var r = this< 8096 span class="pl-kos">.getBounds();
2839+
var r = this.getBounds(this.parent);
28652840
var offset = this.y - r.y;
28662841

28672842
this.y = (value + offset);
@@ -2876,25 +2851,20 @@ Object.defineProperty(Phaser.Group.prototype, "top", {
28762851
* It is derived by calling `getBounds`, calculating the Groups dimensions based on its
28772852
* visible children.
28782853
*
2879-
* Note that no ancestors are factored into the result, meaning that if this Group is
2880-
* nested within another Group, with heavy transforms on it, the result of this property
2881-
* is likely to be incorrect. It is safe to get and set this property if the Group is a
2882-
* top-level descendant of Phaser.World, or untransformed parents.
2883-
*
28842854
* @name Phaser.Group#bottom
28852855
* @property {number} bottom
28862856
*/
28872857
Object.defineProperty(Phaser.Group.prototype, "bottom", {
28882858

28892859
get: function () {
28902860

2891-
return this.getBounds().bottom;
2861+
return this.getBounds(this.parent).b 23C2 ottom;
28922862

28932863
},
28942864

28952865
set: function (value) {
28962866

2897-
var r = this.getBounds();
2867+
var r = this.getBounds(this.parent);
28982868
var offset = this.y - r.y;
28992869

29002870
this.y = (value + offset) - r.height;

src/gameobjects/Image.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
* @extends Phaser.Component.LoadTexture
2525
* @extends Phaser.Component.Overlap
2626
* @extends Phaser.Component.Reset
27+
* @extends Phaser.Component.ScaleMinMax
2728
* @extends Phaser.Component.Smoothed
2829
* @constructor
2930
* @param {Phaser.Game} game - A reference to the currently running game.
@@ -68,6 +69,7 @@ Phaser.Component.Core.install.call(Phaser.Image.prototype, [
6869
'LoadTexture',
6970
'Overlap',
7071
'Reset',
72+
'ScaleMinMax',
7173
'Smoothed'
7274
]);
7375

src/pixi/display/DisplayObjectContainer.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -435,14 +435,14 @@ PIXI.DisplayObjectContainer.prototype.getBounds = function (targetCoordinateSpac
435435
};
436436

437437
/**
438-
* Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration.
438+
* Retrieves the non-global local bounds of the displayObjectContainer as a rectangle without any transformations. The calculation takes all visible children into consideration.
439439
*
440440
* @method getLocalBounds
441441
* @return {Rectangle} The rectangular bounding area
442442
*/
443443
PIXI.DisplayObjectContainer.prototype.getLocalBounds = function () {
444444

445-
return this.getBounds(this.parent);
445+
return this.getBounds(this);
446446

447447
};
448448

@@ -577,7 +577,7 @@ PIXI.DisplayObjectContainer.prototype._renderCanvas = function (renderSession) {
577577
Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
578578

579579
get: function() {
580-
return this.getLocalBounds().width;
580+
return this.getLocalBounds().width * this.scale.x;
581581
},
582582

583583
set: function(value) {
@@ -606,7 +606,7 @@ Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'width', {
606606
Object.defineProperty(PIXI.DisplayObjectContainer.prototype, 'height', {
607607

608608
get: function() {
609-
return this.getLocalBounds().height;
609+
return this.getLocalBounds().height * this.scale.y;
610610
},
611611

612612
set: function(value) {

src/sound/Sound.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,8 @@ Phaser.Sound.prototype = {
555555
this._sound.pause();
556556
this._sound.currentTime = 0;
557557
}
558+
559+
this.isPlaying = false;
558560
}
559561

560562
if (marker === '' && Object.keys(this.markers).length > 0)
@@ -566,10 +568,10 @@ Phaser.Sound.prototype = {
566568

567569
if (marker !== '')
568570
{
569-
this.currentMarker = marker;
570-
571571
if (this.markers[marker])
572572
{
573+
this.currentMarker = marker;
574+
573575
// Playing a marker? Then we default to the marker values
574576
this.position = this.markers[marker].start;
575577
this.volume = this.markers[marker].volume;
@@ -594,7 +596,7 @@ Phaser.Sound.prototype = {
594596
}
595597
else
596598
{
597-
// console.warn("Phaser.Sound.play: audio marker " + marker + " doesn't exist");
599+
console.warn("Phaser.Sound.play: audio marker " + marker + " doesn't exist");
598600
return this;
599601
}
600602
}

typescript/pixi.comments.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -901,7 +901,7 @@ declare module PIXI {
901901
getChildIndex(child: DisplayObject): number;
902902

903903
/**
904-
* Retrieves the non-global local bounds of the displayObjectContainer as a rectangle. The calculation takes all visible children into consideration.
904+
* Retrieves the non-global local bounds of the displayObjectContainer as a rectangle without any transformations. The calculation takes all visible children into consideration.
905905
* @return The rectangular bounding area
906906
*/
907907
getLocalBounds(): Rectangle;

0 commit comments

Comments
 (0)