Skip to content

Commit aeda044

Browse files
committed
Safari on OSX wouldn't recognise button presses on trackpads (thanks JakeCake)
1 parent 20ce29f commit aeda044

3 files changed

Lines changed: 116 additions & 68 deletions

File tree

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ Thousands of developers worldwide use it. From indies and multi-national digital
3939

4040
<div align="center"><img src="http://phaser.io/images/github/news.jpg"></div>
4141

42-
> 23rd July 2015
42+
> 24th July 2015
4343
4444
Phaser 2.4 is another huge update. We had to bump the version number from 2.3 directly to 2.4 because of some API adjustments, all of which are fully detailed in the [Change Log](#change-log). While it's true we could have released it over a few smaller point releases, that just isn't how the cookie crumbled this time. _Be sure to pay attention to the previous deprecated API calls that have been removed in 2.4._
4545

@@ -258,6 +258,7 @@ It also modifies the Grunt build scripts so that all third party libs (such as C
258258
### Bug Fixes
259259

260260
* Fixed Cache.getKeys to use the `_cacheMap` (thanks @jamesgroat #1929)
261+
* Safari on OSX wouldn't recognise button presses on trackpads (thanks JakeCake)
261262

262263
## Version 2.4.0 - "Katar" - 22nd July 2015
263264

build/config.php

Lines changed: 53 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,24 +23,28 @@
2323
'box2d' => false,
2424
'creature' => false,
2525
'video' => true,
26+
'rope' => true,
27+
'tilesprite' => true
2628
);
2729
}
2830

29-
if ($modules['p2'])
31+
if ($modules['creature'])
3032
{
31-
echo " <script src=\"$path/src/physics/p2/p2.js\"></script>";
33+
echo " <script src=\"$path/src/animation/creature/gl-matrix.js\"></script>";
34+
echo " <script src=\"$path/src/animation/creature/CreatureMeshBone.js\"></script>";
3235
}
3336

34-
if ($modules['creature'])
37+
if ($modules['p2'])
3538
{
36-
echo " <script src=\"$path/src/animation/creature/gl-matrix.js\"></script>";
39+
echo " <script src=\"$path/src/physics/p2/p2.js\"></script>";
3740
}
3841

3942
if ($modules['box2d'] && isset($box2dpath))
4043
{
4144
echo " <script src=\"$box2dpath/box2d-html5.js\"></script>";
4245
}
4346

47+
// PIXI Intro
4448
echo <<<EOL
4549
4650
<script src="$path/src/pixi/Pixi.js"></script>
@@ -78,9 +82,22 @@
7882
<script src="$path/src/pixi/primitives/Graphics.js"></script>
7983
<script src="$path/src/pixi/primitives/GraphicsData.js"></script>
8084
81-
<script src="$path/src/pixi/extras/Strip.js"></script>
82-
<script src="$path/src/pixi/extras/Rope.js"></script>
83-
<script src="$path/src/pixi/extras/TilingSprite.js"></script>
85+
86+
EOL;
87+
88+
if ($modules['rope'])
89+
{
90+
echo " <script src=\"$path/src/pixi/extras/Strip.js\"></script>";
91+
echo " <script src=\"$path/src/pixi/extras/Rope.js\"></script>";
92+
}
93+
94+
if ($modules['tilesprite'])
95+
{
96+
echo " <script src=\"$path/src/pixi/extras/TilingSprite.js\"></script>";
97+
}
98+
99+
// PIXI Outro + Phaser Global
100+
echo <<<EOL
84101
85102
<script src="$path/src/pixi/textures/BaseTexture.js"></script>
86103
<script src="$path/src/pixi/textures/Texture.js"></script>
@@ -178,15 +195,40 @@
178195
<script src="$path/src/gameobjects/GameObjectCreator.js"></script>
179196
<script src="$path/src/gameobjects/Sprite.js"></script>
180197
<script src="$path/src/gameobjects/Image.js"></script>
181-
<script src="$path/src/gameobjects/TileSprite.js"></script>
182-
<script src="$path/src/gameobjects/Rope.js"></script>
183198
<script src="$path/src/gameobjects/Button.js"></script>
184199
<script src="$path/src/gameobjects/SpriteBatch.js"></script>
185200
<script src="$path/src/gameobjects/Particle.js"></script>
186201
187202
188203
EOL;
189204

205+
if ($modules['rope'])
206+
{
207+
echo <<<EOL
208+
<script src="$path/src/gameobjects/Rope.js"></script>
209+
210+
211+
EOL;
212+
}
213+
214+
if ($modules['tilesprite'])
215+
{
216+
echo <<<EOL
217+
<script src="$path/src/gameobjects/TileSprite.js"></script>
218+
219+
220+
EOL;
221+
}
222+
223+
if ($modules['creature'])
224+
{
225+
echo <<<EOL
226+
<script src="$path/src/gameobjects/Creature.js"></script>
227+
228+
229+
EOL;
230+
}
231+
190232
if ($modules['bitmapdata'])
191233
{
192234
echo <<<EOL
@@ -303,15 +345,6 @@
303345
304346
EOL;
305347

306-
if ($modules['creature'])
307-
{
308-
echo <<<EOL
309-
<script src="$path/src/animation/creature/CreatureMeshBone.js"></script>
310-
<script src="$path/src/gameobjects/Creature.js"></script>
311-
312-
313-
EOL;
314-
}
315348

316349
if ($modules['sound'])
317350
{
@@ -449,6 +482,8 @@
449482

450483
echo <<<EOL
451484
<script src="$path/src/PixiDefaults.js"></script>
485+
486+
452487
EOL;
453488

454489
if (isset($custom))

src/input/Pointer.js

Lines changed: 61 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -435,65 +435,77 @@ Phaser.Pointer.prototype = {
435435
// If you find one, please tell us!
436436
var buttons = event.buttons;
437437

438-
if (buttons === undefined)
438+
if (buttons !== undefined)
439439
{
440-
return;
441-
}
440+
// Note: These are bitwise checks, not booleans
442441

443-
// Note: These are bitwise checks, not booleans
442+
if (Phaser.Pointer.LEFT_BUTTON & buttons)
443+
{
444+
this.leftButton.start(event);
445+
}
446+
else
447+
{
448+
this.leftButton.stop(event);
449+
}
444450

445-
if (Phaser.Pointer.LEFT_BUTTON & buttons)
446-
{
447-
this.leftButton.start(event);
448-
}
449-
else
450-
{
451-
this.leftButton.stop(event);
452-
}
451+
if (Phaser.Pointer.RIGHT_BUTTON & buttons)
452+
{
453+
this.rightButton.start(event);
454+
}
455+
else
456+
{
457+
this.rightButton.stop(event);
458+
}
459+
460+
if (Phaser.Pointer.MIDDLE_BUTTON & buttons)
461+
{
462+
this.middleButton.start(event);
463+
}
464+
else
465+
{
466+
this.middleButton.stop(event);
467+
}
453468

454-
if (Phaser.Pointer.RIGHT_BUTTON & buttons)
455-
{
456-
this.rightButton.start(event);
457-
}
458-
else
459-
{
460-
this.rightButton.stop(event);
461-
}
462-
463-
if (Phaser.Pointer.MIDDLE_BUTTON & buttons)
464-
{
465-
this.middleButton.start(event);
466-
}
467-
else
468-
{
469-
this.middleButton.stop(event);
470-
}
469+
if (Phaser.Pointer.BACK_BUTTON & buttons)
470+
{
471+
this.backButton.start(event);
472+
}
473+
else
474+
{
475+
this.backButton.stop(event);
476+
}
471477

472-
if (Phaser.Pointer.BACK_BUTTON & buttons)
473-
{
474-
this.backButton.start(event);
475-
}
476-
else
477-
{
478-
this.backButton.stop(event);
479-
}
478+
if (Phaser.Pointer.FORWARD_BUTTON & buttons)
479+
{
480+
this.forwardButton.start(event);
481+
}
482+
else
483+
{
484+
this.forwardButton.stop(event);
485+
}
480486

481-
if (Phaser.Pointer.FORWARD_BUTTON & buttons)
482-
{
483-
this.forwardButton.start(event);
487+
if (Phaser.Pointer.ERASER_BUTTON & buttons)
488+
{
489+
this.eraserButton.start(event);
490+
}
491+
else
492+
{
493+
this.eraserButton.stop(event);
494+
}
484495
}
485496
else
486497
{
487-
this.forwardButton.stop(event);
488-
}
498+
// No buttons property (like Safari on OSX when using a trackpad)
489499

490-
if (Phaser.Pointer.ERASER_BUTTON & buttons)
491-
{
492-
this.eraserButton.start(event);
493-
}
494-
else
495-
{
496-
this.eraserButton.stop(event);
500+
if (event.type === 'mousedown')
501+
{
502+
this.leftButton.start(event);
503+
}
504+
else
505+
{
506+
this.leftButton.stop(event);
507+
this.rightButton.stop(event);
508+
}
497509
}
498510

499511
// On OS X (and other devices with trackpads) you have to press CTRL + the pad

0 commit comments

Comments
 (0)