Skip to content

Commit aea0e4c

Browse files
committed
Pointer.down will now check if the browser is running under macOS and if the ctrl key was also pressed, if so, it will flag the down event as being a right-click instead of a left-click, as per macOS conventions. Fix phaserjs#4245
1 parent 8f59545 commit aea0e4c

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/input/Pointer.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ var Distance = require('../math/distance/DistanceBetween');
1010
var FuzzyEqual = require('../math/fuzzy/Equal');
1111
var SmoothStepInterpolation = require('../math/interpolation/SmoothStepInterpolation');
1212
var Vector2 = require('../math/Vector2');
13+
var OS = require('../device/OS');
1314

1415
/**
1516
* @classdesc
@@ -659,6 +660,13 @@ var Pointer = new Class({
659660
this.downY = this.y;
660661
}
661662

663+
if (OS.macOS && event.ctrlKey)
664+
{
665+
// Override button settings on macOS
666+
this.buttons = 2;
667+
this.primaryDown = false;
668+
}
669+
662670
if (!this.isDown)
663671
{
664672
this.isDown = true;

0 commit comments

Comments
 (0)