77*
88* Phaser - http://phaser.io
99*
10- * v2.4.2 "Altara" - Built: Mon Jul 27 2015 13:35:18
10+ * v2.4.2 "Altara" - Built: Tue Jul 28 2015 14:17:06
1111*
1212* By Richard Davey http://www.photonstorm.com @photonstorm
1313*
@@ -28225,6 +28225,94 @@ Phaser.Pointer.prototype = {
2822528225
2822628226 },
2822728227
28228+ /**
28229+ * Called by updateButtons.
28230+ *
28231+ * @method Phaser.Pointer#processButtonsDown
28232+ * @private
28233+ * @param {integer} buttons - The DOM event.buttons property.
28234+ * @param {MouseEvent} event - The DOM event.
28235+ */
28236+ processButtonsDown: function (buttons, event) {
28237+
28238+ // Note: These are bitwise checks, not booleans
28239+
28240+ if (Phaser.Pointer.LEFT_BUTTON & buttons)
28241+ {
28242+ this.leftButton.start(event);
28243+ }
28244+
28245+ if (Phaser.Pointer.RIGHT_BUTTON & buttons)
28246+ {
28247+ this.rightButton.start(event);
28248+ }
28249+
28250+ if (Phaser.Pointer.MIDDLE_BUTTON & buttons)
28251+ {
28252+ this.middleButton.start(event);
28253+ }
28254+
28255+ if (Phaser.Pointer.BACK_BUTTON & buttons)
28256+ {
28257+ this.backButton.start(event);
28258+ }
28259+
28260+ if (Phaser.Pointer.FORWARD_BUTTON & buttons)
28261+ {
28262+ this.forwardButton.start(event);
28263+ }
28264+
28265+ if (Phaser.Pointer.ERASER_BUTTON & buttons)
28266+ {
28267+ this.eraserButton.start(event);
28268+ }
28269+
28270+ },
28271+
28272+ /**
28273+ * Called by updateButtons.
28274+ *
28275+ * @method Phaser.Pointer#processButtonsUp
28276+ * @private
28277+ * @param {integer} buttons - The DOM event.buttons property.
28278+ * @param {MouseEvent} event - The DOM event.
28279+ */
28280+ processButtonsUp: function (button, event) {
28281+
28282+ // Note: These are bitwise checks, not booleans
28283+
28284+ if (button === Phaser.Mouse.LEFT_BUTTON)
28285+ {
28286+ this.leftButton.stop(event);
28287+ }
28288+
28289+ if (button === Phaser.Mouse.RIGHT_BUTTON)
28290+ {
28291+ this.rightButton.stop(event);
28292+ }
28293+
28294+ if (button === Phaser.Mouse.MIDDLE_BUTTON)
28295+ {
28296+ this.middleButton.stop(event);
28297+ }
28298+
28299+ if (button === Phaser.Mouse.BACK_BUTTON)
28300+ {
28301+ this.backButton.stop(event);
28302+ }
28303+
28304+ if (button === Phaser.Mouse.FORWARD_BUTTON)
28305+ {
28306+ this.forwardButton.stop(event);
28307+ }
28308+
28309+ if (button === 5)
28310+ {
28311+ this.eraserButton.stop(event);
28312+ }
28313+
28314+ },
28315+
2822828316 /**
2822928317 * Called when the event.buttons property changes from zero.
2823028318 * Contains a button bitmask.
@@ -28237,73 +28325,23 @@ Phaser.Pointer.prototype = {
2823728325
2823828326 this.button = event.button;
2823928327
28240- // This is tested back to IE9, but possibly some browsers may report this differently.
28241- // If you find one, please tell us!
28242- var buttons = event.buttons;
28328+ var down = (event.type.toLowerCase().substr(-4) === 'down');
2824328329
28244- if (buttons !== undefined)
28330+ if (event. buttons !== undefined)
2824528331 {
28246- // Note: These are bitwise checks, not booleans
28247-
28248- if (Phaser.Pointer.LEFT_BUTTON & buttons)
28249- {
28250- this.leftButton.start(event);
28251- }
28252- else
28253- {
28254- this.leftButton.stop(event);
28255- }
28256-
28257- if (Phaser.Pointer.RIGHT_BUTTON & buttons)
28258- {
28259- this.rightButton.start(event);
28260- }
28261- else
28262- {
28263- this.rightButton.stop(event);
28264- }
28265-
28266- if (Phaser.Pointer.MIDDLE_BUTTON & buttons)
28267- {
28268- this.middleButton.start(event);
28269- }
28270- else
28271- {
28272- this.middleButton.stop(event);
28273- }
28274-
28275- if (Phaser.Pointer.BACK_BUTTON & buttons)
28276- {
28277- this.backButton.start(event);
28278- }
28279- else
28280- {
28281- this.backButton.stop(event);
28282- }
28283-
28284- if (Phaser.Pointer.FORWARD_BUTTON & buttons)
28285- {
28286- this.forwardButton.start(event);
28287- }
28288- else
28289- {
28290- this.forwardButton.stop(event);
28291- }
28292-
28293- if (Phaser.Pointer.ERASER_BUTTON & buttons)
28332+ if (down)
2829428333 {
28295- this.eraserButton.start( event);
28334+ this.processButtonsDown(event.buttons, event);
2829628335 }
2829728336 else
2829828337 {
28299- this.eraserButton.stop( event);
28338+ this.processButtonsUp(event.button, event);
2830028339 }
2830128340 }
2830228341 else
2830328342 {
2830428343 // No buttons property (like Safari on OSX when using a trackpad)
28305-
28306- if (event.type === 'mousedown')
28344+ if (down)
2830728345 {
2830828346 this.leftButton.start(event);
2830928347 }
@@ -28316,6 +28354,7 @@ Phaser.Pointer.prototype = {
2831628354
2831728355 // On OS X (and other devices with trackpads) you have to press CTRL + the pad
2831828356 // to initiate a right-click event, so we'll check for that here
28357+
2831928358 if (event.ctrlKey && this.leftButton.isDown)
2832028359 {
2832128360 this.rightButton.start(event);
@@ -28339,6 +28378,8 @@ Phaser.Pointer.prototype = {
2833928378 */
2834028379 start: function (event) {
2834128380
28381+ // console.log(event);
28382+
2834228383 if (event['pointerId'])
2834328384 {
2834428385 this.pointerId = event.pointerId;
@@ -57219,6 +57260,10 @@ Phaser.Cache.prototype = {
5721957260 /**
5722057261 * Removes a sound from the cache.
5722157262 *
57263+ * If any `Phaser.Sound` objects use the audio file in the cache that you remove with this method, they will
57264+ * _automatically_ destroy themselves. If you wish to have full control over when Sounds are destroyed then
57265+ * you must finish your house-keeping and destroy them all yourself first, before calling this method.
57266+ *
5722257267 * Note that this only removes it from the Phaser.Cache. If you still have references to the data elsewhere
5722357268 * then it will persist in memory.
5722457269 *
@@ -61158,6 +61203,12 @@ Phaser.Sound.prototype = {
6115861203 */
6115961204 update: function () {
6116061205
61206+ if (!this.game.cache.checkSoundKey(this.key))
61207+ {
61208+ this.destroy();
61209+ return;
61210+ }
61211+
6116161212 if (this.isDecoded && !this._onDecodedEventDispatched)
6116261213 {
6116361214 this.onDecoded.dispatch(this);
0 commit comments