Skip to content

Commit 83a35e4

Browse files
committed
ctrl + click is now only considered a right-click if event.buttons = 1, this should allow you to use ctrl as a key modifier on Windows (and any device with a multi-button mouse attached) and still use ctrl + click on OS X / trackpads for a right-click (thanks @yuvalsv phaserjs#2167)
1 parent 1932515 commit 83a35e4

2 files changed

Lines changed: 4 additions & 2 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,7 @@ You can read all about the philosophy behind Lazer [here](http://phaser.io/news/
375375
* GameObject.revive used to add the health amount given to the Game Object (via `heal`) instead of setting it as the new health amount. It now calls `setHealth` instead, giving it the exact amount (thanks @netgfx #2231)
376376
* Group.add and Group.addAt would forget to remove the child from the hash of its previous Group if it had a physics body enabled, causing unbounded hash increase (thanks @strawlion @McIntozh #2232)
377377
* Fixed a really nasty bug in Chrome OS X where a ctrl + click (i.e. simulated right-click) on a trackpad would lock up the Pointer leftButton, causing future clicks to fail. This is now handled by way of a mouseout listener on the window object, sadly the only way to force a mouseup in Chrome (thanks @KyleU #2286)
378+
* ctrl + click is now only considered a right-click if event.buttons = 1, this should allow you to use ctrl as a key modifier on Windows (and any device with a multi-button mouse attached) and still use ctrl + click on OS X / trackpads for a right-click (thanks @yuvalsv #2167)
378379

379380
### Pixi Updates
380381

src/input/Pointer.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -553,9 +553,10 @@ Phaser.Pointer.prototype = {
553553
}
554554

555555
// On OS X (and other devices with trackpads) you have to press CTRL + the pad
556-
// to initiate a right-click event, so we'll check for that here
556+
// to initiate a right-click event, so we'll check for that here ONLY if
557+
// event.buttons = 1 (i.e. they only have a 1 button mouse or trackpad)
557558

558-
if (event.ctrlKey && this.leftButton.isDown)
559+
if (event.buttons === 1 && event.ctrlKey && this.leftButton.isDown)
559560
{
560561
this.leftButton.stop(event);
561562
this.rightButton.start(event);

0 commit comments

Comments
 (0)